Skip to main content

What am I setting out to achieve?

I want to meet the following requirements:

  • Boolean operators in the search.  Tested against the following terms
    • abalone NOT salmon – 1159
    • abalone -salmon – 1159
    • abalone AND salmon – 478
    • abalone +salmon – 1195
    • abalone OR salmon – 2316
    • abalone || salmon – 2316
  • Phrases in quotations marks - this time to be tested against
    • "of this stimulates an interest in the sea and a love for the marine environment" – 1
    • of this stimulates an interest in the sea and a love for the marine environment - 5686

Note:

  • The numbers after the dash are the results returned from the query;
  • In phrases - the difference between first and second is the first look for the text in quotation marks in its entirety.  Whereas, the second, looks for any of the words in the string.

 

Set up

OK, this is over the top information, but I wanted to provide more details about the current structure.

Solr Version 8.11.1
Drupal search_api drupal-4.2.4-solr-8.x-0

 

Server:

Most of the settings noted below are stock standard with your install.

Solr Connector Standard
Solr Host localhost
Query timeout 5
Index timeout 5
Optimize timeout 10
Finalize timeout 30

 

Advanced

OK, this is over the top information, but I wanted to provide more details about the current structure.

Default result rows 10
Index single document fallback count 10

 

Index:

Cron batch size 250

 

 

View set-up

Filter criteria - Search: Fulltext search (and)

Expose this filter Yes
Single filter Yes
Label Search
Operator Contains all of these words
Parse mode Direct query
Filter identifier search
Searched fields Select what is required.  I left blank to select all

 

Related articles

Andrew Fletcher17 Feb 2024
Drupal - Solr working through tm_X3b_en_body error
Having updated Solr, re-indexing wasn't working. The error in the logs wasDrupal\search_api_solr\SearchApiSolrException while indexing item entity:node/2386:en: Solr endpoint http://127.0.0.1:8983/ bad request (code: 400, body: Exception writing document id...
Andrew Fletcher17 Feb 2024
Solr commands
On an Ubuntu 20.02 system with Nginx, you can utilize the following commands to handle Solr:To verify the status of the Solr servicesudo systemctl status solrTo restart the Solr servicesudo systemctl restart solrStart Solrsudo systemctl start solrStop Solrsudo systemctl stop solrEnable Solr (Start...