After updating drupal/search_api_solr from 4.3.10 to 4.3.12 on Drupal 10.6.14, Search API Autocomplete stopped returning suggestions for an index field of type solr_text_unstemmed.

The index contains two fields based on the same source property:

field_vrije_term_name:
  property_path: 'field_vrije_term:entity:name'
  type: 'solr_text_custom:string'

trefwoorden_unstemmed:
  property_path: 'field_vrije_term:entity:name'
  type: solr_text_unstemmed

field_vrije_term_name is populated and returns Terms/autocomplete suggestions. However, trefwoorden_unstemmed is empty after a full reindex.

The generated Solr mapping for the unstemmed field is:

m_trefwoorden_unstemmed

This appears incorrect. For the Dutch unstemmed field type, I would expect a language-specific `tu` field such as:

tum_X3b_nl_trefwoorden_unstemmed

On the affected site, Solr documents contain values in tcstringm_X3b_nl_field_vrije_term_name, while m_trefwoorden_unstemmed is null. Solr Terms returns suggestions for the former and an empty result for the latter.

Downgrading Search API Solr to 4.3.10 restores autocomplete. The regression appears to have been introduced in 4.3.11, which includes hook-related changes.

Comments

ecvandenberg created an issue. See original summary.

mkalkbrenner’s picture

Assigned: Unassigned » mkalkbrenner

I was able to reproduce that with a test:

There were 2 failures:
1) Drupal\Tests\search_api_solr_autocomplete\Kernel\SearchApiSolrAutocompleteTest::testBackend
Failed asserting that 0 matches expected 1.
/builds/project/search_api_solr/vendor/phpunit/phpunit/src/Framework/Constraint/Equality/IsEqual.php:95
/builds/project/search_api_solr/modules/search_api_solr_autocomplete/tests/src/Kernel/SearchApiSolrAutocompleteTest.php:72
/builds/project/search_api_solr/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
2) Drupal\Tests\search_api_solr\Kernel\SolrFieldNamesTest::testSolrFieldNames
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'tum_X3b_und_title_unstemmed'
+'m_title_unstemmed'
/builds/project/search_api_solr/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:122
/builds/project/search_api_solr/vendor/phpunit/phpunit/src/Framework/Constraint/IsIdentical.php:80
/builds/project/search_api_solr/tests/src/Kernel/SolrFieldNamesTest.php:103
/builds/project/search_api_solr/vendor/phpunit/phpunit/src/Framework/TestResult.php:729

  • mkalkbrenner committed de968847 on 4.x
    fix: #3613277 solr_text_unstemmed fields are no longer populated after...
mkalkbrenner’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

ecvandenberg’s picture

Tested the latest drupal/search_api_solr:4.x-dev@dev just now and indeed, autocomplete is returning suggestions again.

stefan.korn’s picture

Confirm issue and fix. This does not only affect autocomplete (or autocomplete is only the symptom, not the cause), but solr_text_unstemmed in general. Field stays empty in index without the patch.

stefan.korn’s picture

And since current version of search_api_solr with the fix only supports 11.3 and above, using Drupal 10.6 you would need this patch.