Searches with common words like "and" return no results due to Solr syntax error

Created on 7 May 2025, 2 months ago

Problem/Motivation

Searches containing the word "and" (and potentially other stopwords or reserved terms) result in empty results. This is due to Solr throwing a syntax error when processing the termfreq() function with quoted values.

Example log error:
{
"error": {
"metadata": [
"error-class", "org.apache.solr.common.SolrException",
"root-error-class", "org.apache.solr.search.SyntaxError"
],
"msg": "org.apache.solr.search.SyntaxError: Expected ',' at position 35 in 'termfreq(\"tm_X3b_en_field_boost\",\"\"and\"\")'",
"code": 400
}
}

Steps to reproduce

  1. Enable search_api_solr_boosted_keyword.
  2. Perform a search that includes the word and.
  3. Observe that results are empty and a Solr syntax error appears in logs.

Proposed resolution

Remove the quotation marks in the termfreq() function parameters. The Solarium helper already escapes input, and the extra quotes cause Solr to misinterpret the function syntax.

Remaining tasks

  • Review and test the patch.
  • Commit the fix if approved.

User interface changes

-

API changes

-

Data model changes

-

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Taiger Bend, Oregon

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

Comments & Activities

Production build 0.71.5 2024