On 10/23/2018 8:20 AM, Gauri Dhawan wrote:
I have been facing an issue for quite some time and haven't been able to
come to a solution as of yet. We are trying to implement search on our
platform and all our data is stored in Solr.

I have a field `description` which is the field where I have to search.
It is of the field type `text_edit_suggest` and it looks something like this

<fieldType name="text_suggest_edge" class="solr.TextField">
       <analyzer type="index">
<snip>
         <tokenizer class="solr.KeywordTokenizerFactory"/>
<snip>
           <tokenizer class="solr.StandardTokenizerFactory "/>
<snip>
      <analyzer type="query">
<snip>
         <tokenizer class="solr.KeywordTokenizerFactory"/>
<snip>
When I search for multiple keywords, the results are unexpected.
For example :
I want to search for the words `first` and `post` and both these words
should be present in the description field of the document else it
shouldn't return the document.

Your index analysis has two tokenizers.  You can only have one.  There is at least one typo in the fieldType definition provided.  After I fix that, Solr 7.5.0 won't load the core, with this as the error:

Plugin init failure for [schema.xml] fieldType "text_suggest_edge": Plugin init failure for [schema.xml] analyzer/tokenizer: The schema defines multiple tokenizers for: [tokenizer: null]

What version of Solr are you running?  Have you explicitly included the "sow" parameter on your query, or in the handler definition?

The KeywordTokenizerFactory that you're using probably doesn't do what you think it does.  It preserves the entire input as a single token -- doesn't split it into separate words.  The kind of searching you mentioned likely isn't possible with the analysis chain you've got.  It might take a bunch of back and forth question/answer cycles to get to something useful.

In my strong opinion, that KeywordTokenizerFactory has a terrible name and needs a new one.  Anyone want to bikeshed the possibilities?

Thanks,
Shawn

Reply via email to