0

My task is to provide a match when the search term contains the indexed field.

For example:

  • If textExactMatch= foo bar and query= foo, I should not get a MATCH
  • If textExactMatch= foo bar and query= foo bar, I should get a MATCH
  • If textExactMatch= foo bar and query= xyz foo bar/foo bar xyz, I should get a MATCH

I am indexing my field as follows:

<fieldType name="textExactMatch" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
     <tokenizer class="solr.KeywordTokenizerFactory"/>
     <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
     <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

So I'm indexing the text for the field as it is without breaking it further down. How should I tokenize and filter the field during query time?

user2989124
  • 183
  • 2
  • 12
  • I'd recommend looking into [`ShingleFilter`](http://lucene.apache.org/core/4_8_0/analyzers-common/org/apache/lucene/analysis/shingle/ShingleFilter.html). And probably `WhitespaceTokenizer` for the tokenizer. – femtoRgon Jul 21 '14 at 17:08
  • You can tweak the behaviour with `mm` to get "at least % must match" or "x clauses doesn't have to match". If you however have a very long query, I guess you're attempting to do reverse search / stored searches / prospective searches, which you might want to look at the [MemoryIndex](https://lucene.apache.org/core/3_6_0/api/contrib-memory/org/apache/lucene/index/memory/MemoryIndex.html) for - not sure if there's decent Solr support of the box there yet. – MatsLindh Jul 21 '14 at 17:09

0 Answers0