> I wanted to do phrase search. What are the analyzers > that best suited for phrase search. I tried with > "textgen", but it did not yield the expected results. > > I wanted to index: > > my dear friend > > If I search for "dear friend", I should get the result and > if I search for "friend dear" I should not get any records. >
Default PhraseQuery is unordered. "dear friend" returns documents containing "friend dear". It is not about Analyzer but QueryParser. So you want ordered phrase queries. With SOLR-1604 you can accomplish what you want. It constructs ordered SpanNearQuery instead of PhraseQuery. For example features:"stick memory" returns this snippet: SmartMedia, Memory <em>Stick</em>, <em>Memory</em> Stick Pro, SD Card http://localhost:8983/solr/select/?q=features:%22stick%20memory%22&version=2.2&start=0&rows=10&indent=on&defType=complexphrase&debugQuery=on&hl=true&hl.fl=features https://issues.apache.org/jira/browse/SOLR-1604