Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String length function query in Solr

Tags:

solr

lucene

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?

like image 721
snakile Avatar asked Apr 24 '14 13:04

snakile


1 Answers

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}.*/
like image 56
snakile Avatar answered Oct 13 '22 01:10

snakile