检查 solr 方面查询是否大于特定日期时间值
我现在在 solr 中有以下内容
<str name="id">2</str> <arr name="parsed"> <str>2011-11-01 13:40:08.0</str> </arr> <arr name="person"> <str>Harsh Snehanshu | Apoorv Jain</str> </arr>
如果我想搜索 jain
,
http://192.168.1.135:8888/solr/MyCol/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&facet=true&fq=person:jain
,我现在将使用这个查询,问题是:我如何搜索之后已解析的条目(大于) 2011-11-01 13:00:00 或 (2011-11-01 12:30:00 至 2011-11-01 之间13:30:00)??
感谢您的帮助
I have the following in solr
<str name="id">2</str> <arr name="parsed"> <str>2011-11-01 13:40:08.0</str> </arr> <arr name="person"> <str>Harsh Snehanshu | Apoorv Jain</str> </arr>
now if i want to search for jain
, simply i will use this query
http://192.168.1.135:8888/solr/MyCol/select/?q=*%3A*&version=2.2&start=0&rows=10&indent=on&facet=true&fq=person:jain
now the question is: how can i search for entries that have been parsed AFTER (greater than) 2011-11-01 13:00:00 or (between 2011-11-01 12:30:00 and 2011-11-01 13:30:00)??
Thanks for your help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这些查询参数应该有效(未测试且未转义 url)
说明:
facet.field=parsed
在字段parsed
中启用分面。f.parsed.facet.range.start/end
定义该字段的下限和上限。NOW+1YEAR
。有关详细信息,请参阅 Solr 文档中的按范围排列部分细节。
These query parameters should work (not tested and not url escaped)
Explanation:
facet.field=parsed
enables faceting in the fieldparsed
.f.parsed.facet.range.start/end
define the lower and upper bound for that field.NOW+1YEAR
are allowed.See the Facet by Range section in the Solr documentation for further details.
解析的字段需要定义为 datefield。
例如
schema.xml -
TrieDateField 的字段类型应该可用 -
将 prased 字段与 tdate 字段类型映射为 -
因此,在索引时,响应将显示为2009- 04-28T00:00:00Z
这将允许您使用 日期字段的日期过滤器查询。
例如
fq=parsed:[1995-12-31T23:59:59.999Z TO 2007-03-06T00:00:00Z]
另外,对于搜索,最好使用
q=person:耆那教
。使用过滤器查询来限制文档而不是搜索。
The parsed field needs to be defined as a datefield.
e.g.
schema.xml -
Field type of TrieDateField should be available -
Map the prased field with the tdate field type as -
So, when indexed, the response it would appear as
<date name="parsed">2009-04-28T00:00:00Z</date>
This would allow you to use date filter queries for the datefield.
e.g.
fq=parsed:[1995-12-31T23:59:59.999Z TO 2007-03-06T00:00:00Z]
Also for search it would be better to use
q=person:jain
.Use filter queries for restricting the documents rather than searching.