Hello,

I am trying to perform a partial search on a field in solr. my_id: ABC_00123

I would like to search for 123 and see this item. I cannot get it to work without using the my_id field in the query.

In my schema.xml I have put:

<fieldType name="text_ngrm" class="solr.TextField" positionIncrementGap="100">

      <analyzer type="index">
          <tokenizer class="solr.WhitespaceTokenizerFactory" />
<filter class="solr.NGramFilterFactory" minGramSize="1" maxGramSize="50" />

          <filter class="solr.LowerCaseFilterFactory" />
      </analyzer>
      <analyzer type="query">
          <tokenizer class="solr.WhitespaceTokenizerFactory" />
          <filter class="solr.LowerCaseFilterFactory" />
      </analyzer>
</fieldType>
Then (I'm not sure this is necessary):

<field name="_text_ngrm_" type="text_ngrm" indexed="true" stored="false"/>
I also have:

<field name="my_id" type="text_ngrm" indexed="true" stored="true"/>
Finally:

<copyField source="my_id" dest="_text_ngrm_"/>
For the query this works: my_id: 223

But 223 on it's own does not. I have the feeling it has to do with this copyField definition.

The only way, I could get it to work was to change:

<initParams path="/update/**,/query,/select,/tvrh,/elevate,/spell,/browse">
    <lst name="defaults">
      <str name="df">_text_ngrm_</str>
    </lst>
</initParams>
But this breaks all my other default searches. Is there not some way to add like:

<initParams path="/update/**,/query,/select,/tvrh,/elevate,/spell,/browse">
    <lst name="defaults">
      <str name="df">_text_</str>
      <str name="df">_text_ngrm_</str>
    </lst>
</initParams>


I understand the lucene query parser (which is the default option) can only search one default field, controlled by the df parameter. But the dismax and edismax query parsers can search multiple fields.

But how can this be configured and is it likely to change the behaviour of everything else? I understand I could configure one of your search handlers to use edismax and then tell it to search any combination of fields. But now could I do this.

Thanks for any help

Reply via email to