Solr - How to set a default operator in Solr 6.6?
Asked Answered
O

1

5

In Solr 6.6 the defaultOperator config setting has been deprecated in managed-schema

 <solrQueryParser defaultOperator="OR"/>

Where should I set it in Solr 6.6?

Omura answered 14/7, 2017 at 12:26 Comment(1)
use "q.op" query parameter while requesting to solr. if default operator is set to AND and if you mention OR with q.op. The "q.op" request parameter takes precedence.Peristalsis
O
7

As for vinod suggestion, that parameter can be used at query time with q.op=OR, and if you, like me, prefer to have it predefined you can add the value in solrconfig.xml itself, in the /select requestHandler

In the same file is possible to specify also a <defaultSearchField> (also deprecated and removed) with the df parameter

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="df">text_en</str>
        <str name="q.op">OR</str>
    </lst>
</requestHandler>
Omura answered 14/7, 2017 at 20:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.