Search code examples
solrmatchphrase

prevent solr phrase query from being stemmed or stripped of stopwords


I'm trying to check if this feature is even possible to implement with Solr.

I have a text field defined and on the query analyzer I've defined among others a StopFilterFactory and a PorterStemFilterFactory.

I use edsimax as the request handler.

under my current implementation, if i search for:
q = "this is a phrasing query" this is not phrasing

the lucene query will be: (excuse me for the pseudo syntax )
text:"this ? ? phras query" | text: this | text:phras

where what i would like to get is:
text:"this is a phrasing query" | text: this | text:phras

In other words i would like to set the behavior of wrapping a phrase with quotes to be:
a document will only match if the entire phrase without any tokenizing will appear in it.

I understand it maybe possible by defining an additional field which will not undergo any processing and increasing it's boost on the edismax configuration.

but this will return matches for documents which don't include the exact phrase.

Can this be implemented on Solr? How?


Solution

  • How about matching different parts of the query against separate fields? Either through a fq to filter against text_exact or through regular search syntax for scoring as well: text_exact:"this is a phrasing query" this is not phrasing where the last terms should be searched against the default search field or qf iirc.