Problem/Motivation

I got this error:

The website encountered an unexpected error. Please try again later.
TypeError: Drupal\search_api_page\Controller\SearchApiPageController::finishBuildWithoutResults(): Argument #2 ($result) must be of type Drupal\search_api\Query\ResultSetInterface, null given, called in /app/web/modules/contrib/search_api_page/src/Controller/SearchApiPageController.php on line 125 in Drupal\search_api_page\Controller\SearchApiPageController->finishBuildWithoutResults() (line 300 of modules/contrib/search_api_page/src/Controller/SearchApiPageController.php).

Steps to reproduce

Search query contains a " -" character set (whitespace and hyphen), although hyphen is added to ignored chars for search index. Not sure here.
My config(patch from comment #9 from #3108496 is applied):

My search api page config

Proposed resolution

Add a default NULL value for $result parameter in finishBuildWithoutResults method.

Remaining tasks

Review the patch.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

granik created an issue. See original summary.

granik’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new1.1 KB
granik’s picture

I'm not sure why these characters cause a such error, maybe something wrong with search_api module is used (haven't checked with solr). I would need help here!

granik’s picture

Version: 8.x-1.0 » 8.x-1.x-dev

Also found a related issue, the status is still active. I guess that's the reason.
https://www.drupal.org/project/drupal/issues/3195524
My workaround patch #2 works, but in this case still no results found.

granik’s picture

josephcheek’s picture

This patch, #2, is the same patch in bug# 3332016, patch #2, which works for me in my use case (Solr not available). I voted for RTBC on that patch, so does that count as a vote for RTBC in this issue as well? Do bug votes have transient properties?

If so, I vote +1 for RTBC.

josephcheek’s picture

joachim’s picture

I also got this when no fields were selected because of #3527868: no options show for 'Searched fields' if the only field is 'rendered_item'.