Performing EXACT match on SOLR search

You are using StandardTokenizerFactory, which adheres to Word Boundary rules.

This would mean that your words get split on spaces.

if you want a real exact match, i.e

Richard Chase to return documents containing only Richard Chase exactly, then you should you KeywordTokenizerFactory.

But as you mention, you want Richard John Chase but not Johnny Chase, it tells me that you want matches for Richard and Chase.

You could either search for Richard AND Chase or change your default operator in schema.xml to be AND instead of OR. Beware that this setting is global.


You have to use PhraseQuery (text:"Richard Chase") to get documents where both Ricahard and Chase are near to each other. If you want also to find, say, Richard X. Chase you can use text:"richard chase"~1.

See http://www.solrtutorial.com/solr-query-syntax.html


For exact match you can set mm(Minimum "Should" Match) parameter of your query parser to 100% in your solrconfig.xml

<str name="mm">100%</str>

This specifies a minimum number of clauses that must match in a query. Or you can override this parameter (q.mm) at query-time in request

Tags:

Solr