0

I'm trying to work out how to set the text analyzer for a search query in Solr (8.11.1)

Here is my handler set in solrconfig.xml:

  <requestHandler name="/select" class="solr.SearchHandler">

    <!-- default values for query parameters can be specified, these
         will be overridden by parameters in the request
      -->

    <lst name="defaults">
      <str name="echoParams">explicit</str>
      <int name="rows">100</int>
      <int name="qs">8</int>
    </lst>
    
  </requestHandler>

What I want to do is be able to use this field type to do the search: (this is set in managed-schema.xml)

  <fieldType name="synonymized" class="solr.TextField">
      <analyzer type="query">
          <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.SynonymGraphFilterFactory" synonyms="synonyms.txt" format="solr" ignoreCase="true" expand="true" tokenizerFactory="solr.WhitespaceTokenizerFactory"/>
            <filter class="solr.PatternReplaceFilterFactory" pattern="(_)" replacement=" " replace="all"/>
            <filter class="solr.EnglishPossessiveFilterFactory"/>
      </analyzer>
  </fieldType>

How do I go about that? For Solr 6.6 (our old server), we used this plugin: https://github.com/o19s/match-query-parser , and then passed in analyze_as=synonymized, but unfortunatly that plugin doesn't seem to work on Solr 8.11.1

Hopefully that makes sense! Please ask if you need clarification on anything (Solr is a complex beast, and I'm still trying to get my head around some of it!)

Andrew Newby
  • 4,941
  • 6
  • 40
  • 81
  • 1
    Long shot. I suspect the plug-in does not work with Solr 8.x because starting in Solr 7.2 (https://solr.apache.org/guide/7_5/solr-upgrade-notes.html#solr-7-2) local parameters are not supported the plug-in uses that syntax `bq={!match analyze_as=text_synonym search_with=term qf=body v=$q}`. In a previous job I was able to get that functionality back by setting the parser to Lucene (instead of eDisMax) in my solrconfig.xml and switching to eDisMax at query time (see https://library.brown.edu/create/digitaltechnologies/upgrading-from-solr-4-to-solr-7/) – Hector Correa Jan 03 '22 at 19:00
  • 1
    @HectorCorrea thanks for that. I ended up being able to achieve what we needed using edismax, along with params that worked as we wanted :) – Andrew Newby Jan 04 '22 at 06:30

0 Answers0