mlissner
mlissner

Reputation: 18166

Disable synonyms and stemming on a per query basis in Solr

We run a legal search engine. Lawyers, being rather particular generally want synonyms and stemming turned on, but sometimes want to turn them off for certain queries.

For example, we have one user that wants to search for:

judgments

Not:

judgements (with two e's)

Or:

judgment (singular, not plural)

Is there a way to do this? I know it will blow up my index size a bit.

Upvotes: 1

Views: 508

Answers (1)

Persimmonium
Persimmonium

Reputation: 15771

the easiest way would be:

  1. index this into two fields (use copyField), one with synonyms and one without (index or query time, that decision is orthogonal to this).
  2. when running your queries, match against one field or the other depending whether you want synonyms used or not.

Upvotes: 3

Related Questions