用lucene对时间索引后搜索的问题。

我的数据量比较大,故后台采用一个线程专用于索引的建立。目前索引库已经在700多M了,估计全部建立完成在1.5G左右。
每一个doc里包括了一个field(sendtime,时间字符串,yyyy-mm-dd hh:MM:ss格式)

在前台web进行搜索时。采用如下代码
[code]
/**
* sendtime在date1与date2之间的数据
*/
if (startTime != null && (!"null".equalsIgnoreCase(startTime))
&& startTime.length() > 0 && endTime != null
&& (!"null".equalsIgnoreCase(endTime))
&& endTime.length() > 0) {
RangeQuery dateQuery = new RangeQuery(new Term("sendtime",
startTime), new Term("sendtime", endTime), true);
query.add(dateQuery, BooleanClause.Occur.MUST);
}
[/code]

此时有一个很奇怪的现象
如果从2007-01-12 23:59:59 TO 2007-01-13 23:59:59开始搜索就能查出大约4000条数据,其中包括2007-01-13 22点的数据约2000条。
如果从[2007-01-13 00:00:00 TO 2007-01-13 23:59:59]来查询13号的数据,居然没有。

有没有哪位大xia遇到过类试的问题????
发布了2 篇原创文章 · 获赞 0 · 访问量 2469
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章