Phrase Search Doesn't Work as Intended

Created on 14 February 2025, about 2 months ago

Searching for a phrase returns the same results as if searching for individual words

Setup

  • Solr version: 8.0
  • Drupal Core version: 10.4.2
  • Search API version: 8.x-1.37
  • Search API Solr version: 4.3.7
  • Configured Solr Connector: Pantheon Search Connector

Issue

I am using the Search API Pantheon module to connect to Solr. I am getting the same search results when I search for for multiple words or a phrase consisting of the same words put in double quotes.

For example, the following two searches return the same results (basically, the double quotes are ignored):

Index: primary
Keys: 'deal with'
Parsed keys: array (
    '#conjunction' => 'AND',
    0 => 'deal',
    1 => 'with',
  )
Index: primary
Keys: '"deal with"'
Parsed keys: array (
    '#conjunction' => 'AND',
    0 => 'deal with',
  )

I am not sure if this is a problem with the Search API Solr module or there is something wrong the Solr index.

🐛 Bug report
Status

Active

Version

4.3

Component

Miscellaneous

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mvnovick
  • 🇩🇪Germany mkalkbrenner 🇩🇪

    turn on search_api_solr_devel to see the resulting Solr queries and why they match a document.

  • I enabled the search_api_solr_devel module and examined the debugging information it provided. It looks like Solr removes stopwords from phrase searches. For example, the search for 'one or two' becomes the search for 'one ? two'. Also, grammatical stemming is applied to phrase searches as well. For example, the search for 'admitted students' becomes the search for 'admit student'. The Stopwords and Stemmer processors are not enabled in the Drupal configuration for the Solr index. Is there any way to disable stopwords and stemming in phrase searches? Theoretically, I can delete all stopwords from the Solr Schema, but I would still like to skip stopwords in multi-word searches.

Production build 0.71.5 2024