Is it possible to find a document if the indexed field is a part of the queried phrase?
It it easy to find "Quick brown fox jumps over the lazy dog" when searching for "brown fox" or "lazy dog". But what if I need to do it vice versa?
Here's my situation: I have a short field in a document like "brown fox" or "lazy dog" and I want this document to be found by searching for longer phrases like "Quick brown fox" or "jump over lazy dog".
Note: it should be a phrase match, so making all the terms optional in the query wouldn't work. The query like "brown dog" SHOULD NOT match.
How would you do it in Solr? Is it possible to achieve this goal by only tweaking Solr, without necessity to parse and modify the requested phrase on the client side?
look at ShingleFilterFactory. If you apply that to the query side only, you could achieve what you are looking for.
来源:https://stackoverflow.com/questions/11986510/solr-phrase-search-when-indexed-phrase-is-shorter-than-the-query