I need to find all the documents in my collection for which the length of a certain field exceeds a certain limit. The field's type is string. Is there a function query that returns the length of a string field in Solr?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
The solution is to use Solr's regex capabilities. For example, the following query retrieves all the documents for which the title
field is at least 42:
title:/.{42}.*/
回答2:
Querying by length is not supported out of the box, the most sensible way would be to create a separate (numeric) field and query by this field.