문제

I'm about to add a feature to my project that will allow users to place a Solr query like...

immigration law citations:50

...which would yield legal documents containing 'immigration' AND 'law' AND a citation count greater than 50.

Internally, I can parse out strings like citations:50 and convert them to citations:[50 TO *], but post-processing the query parser is best avoided if possible.

Seems like there ought to be a way in the schema to say, "When people search on this field, always look for the value and find anything greater."

Anything like that or ideas for how to do this elegantly? I hate query postprocessing in my app. Nasty stuff.

도움이 되었습니까?

해결책

In order not to depend on a particular QueryParser implementation, you could create a custom field type by overriding the getFieldQuery method of the field type you are currently using to return a range query instead of a term query.

See the default implementation for getFieldQuery.

But I still find it a little misleading to have : mean .

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top