您应该使用 从 和 到 的范围查询。
query = monthQb .range() .onField( "startTS" ).ignoreFieldBridge() .from( DateTools.dateToString( from, DateTools.Resolution.MILLISECOND ) ) .to( DateTools.dateToString( to, DateTools.Resolution.MILLISECOND ) ).excludeLimit() .createQuery();
因为您使用 DateTools 自己创建了基于字符串的搜索字符串,所以需要 ignoreFieldBridge 。



