How to change Solr default conjunction operator (Search)
This is a how-to article created by a team member in Digizuite Service Delivery. Please try to follow the guide, and if you have suggestions or improvements please just change it directly in the document.
Checklist
The checklist is a tool to ensure you remember to perform all steps in the how-to article. It provides an overview with the option to drill down into the how-to guide. If possible make the checklist chronological.
Things to be aware of!
The Solr search core needs to be repopulated after configuration, which means that assets will disappear from the Media Manager until they have been indexed again.
How-to guide:
As Solr uses the OR boolean operator as the default conjunction this will show how to configure a different default operator. In this example, the AND operator is added instead of OR.
Stop SolrServices (SolrJetty/SolrApache) on the webserver
Locate the Solr search core that needs to be changed (Default location: C:\Bitnami\solr-8.3.1-1\apache-solr\server\solr or Digizuite drive).
Open the <CoreName>\Conf\solrconfig.xml file.
Find the requestHandler section:
<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">10</int> <!-- Default search field <str name="df">text</str> --> <!-- Change from JSON to XML format (the default prior to Solr 7.0) <str name="wt">xml</str> --> </lst> --> ... <!-- <arr name="components"> <str>nameOfCustomComponent1</str> <str>nameOfCustomComponent2</str> </arr> --> </requestHandler>
Ā
Add
<str name="q.op">AND</str>
to the<lst></lst>
section. E.g.<lst name="defaults"> <str name="echoParams">explicit</str> <str name="q.op">AND</str> <int name="rows">10</int> </lst>
Ā
Delete the <CoreName>\Data folder
Start SolrServices
Repopulate the search from the Digizuite DAM Center.
Resources:
Your contribution is important
Help us improve - together!
If youād like to provide any feedback or suggested improvements to this guide, please feel free to leave a comment and the author will be notified.
Thank you.