0

Am looking for a way where I can search precisely for a scenario:

say word: 'stack-overflow'

I want to search documents having exactly 'stack' AND '-' AND 'overflow' not OR.

I understand from what I have read, words are split as this "stack-overflow" -> "stack", "overflow".

Can we preserve the original word on index?

I tried the solution mentioned here but did not work: Rails sunspot-solr - words with hyphen

Also tried this code:

<fieldType name="autosuggest" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.WordDelimiterFilterFactory"
            generateWordParts="1"
            splitOnNumerics="1"
            catenateWords="1"
            catenateAll="1"
            preserveOriginal="1"
            />
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.EdgeNGramFilterFactory" minGramSize="1" maxGramSize="25" />
  </analyzer>
  <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.WordDelimiterFilterFactory"
            generateWordParts="1"
            splitOnNumerics="1"
            catenateWords="0"
            catenateAll="0"
            preserveOriginal="1"
            />
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

Any help or guidance is appreciated.

Community
  • 1
  • 1
abhijit
  • 1,958
  • 3
  • 28
  • 39

1 Answers1

0

You can simply write your query in double quotes("stack-overflow"). That would do the job as you have already mentioned to preserve original index time.