
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):
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3358814-add-default-null-result.patch | 1.1 KB | granik |
Screenshot-from-2023-05-08_11-47-25.png | 61.83 KB | granik |
Comments
Comment #2
granikComment #3
granikI'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!
Comment #4
granikAlso 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.
Comment #5
granikComment #6
josephcheekThis 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.
Comment #7
josephcheekComment #8
joachim CreditAttribution: joachim at Gulp Digital commentedI also got this when no fields were selected because of #3527868: no options show for 'Searched fields' if the only field is 'rendered_item'.