- ๐ซ๐ฎFinland anaconda777
Hi,
Applied the patch #4 to 1.28.0 but still got this message:
PHP message: Error: Call to a member function getResults() on null in /var/www/html/finnlearn_test/web/modules/contrib/search_api/src/Plugin/views/query/SearchApiQuery.php on line 867 #0
- ๐ฎ๐ณIndia siddharthjain
Added the patch for the issue mentioned in #6, here is the updated patch(Call_on_Null-3321499-7.patch) and interdiff_4-7.txt
Situations, when indexes are disabled, won't lead you to a fatal error using views with search_api, thanks to this patch.
#7 works for me.
- last update
over 1 year ago 536 pass - ๐ฆ๐นAustria drunken monkey Vienna, Austria
Thanks a lot for your comment, mialdi98, this is the first clue to the cause of this issue.
Can others confirm that they also have a disabled search index on their site?Otherwise, it would be very important to know why
getSearchApiQuery()
returnsNULL
, so that we donโt just apply a band aid that fixes the symptoms but ignore the underlying problem.Regarding the patches: We donโt yet depend on PHP 8, so please use the long syntax for null safety. Patch attached, please test/review!
- heddn Nicaragua
In my case, I did have a disabled search index when running
facets_update_8010
. The patch in #9 fixed the issue. - Status changed to RTBC
over 1 year ago 9:08am 25 May 2023 - last update
over 1 year ago 536 pass - ๐ฎ๐ณIndia Supreetam09 Kolkata
We had the same issue and under same scenarios.
We had a disabled search index and we ended up on the same error. Also other update hooks from Facet modulefacets_update_8012
was failing for the same error.I can also confirm after applying the patch #9, the issue got fixed. Thanks for the patch.
I think we can move to RTBC!
-
drunken monkey โ
committed b9130b78 on 8.x-1.x authored by
andrew-minich โ
Issue #3321499 by andrew-minich, Shriaas, siddharthjain_7998, drunken...
-
drunken monkey โ
committed b9130b78 on 8.x-1.x authored by
andrew-minich โ
- Status changed to Fixed
over 1 year ago 3:39pm 27 May 2023 - ๐ฆ๐นAustria drunken monkey Vienna, Austria
Good to hear, thanks for testing and reporting back!
Merged.
Thanks again, everyone! - Status changed to Needs review
over 1 year ago 8:59am 8 June 2023 - last update
over 1 year ago 539 pass - ๐ฎ๐ณIndia Supreetam09 Kolkata
I think the previous patch/commit is still incomplete as I landed on the error while accessing view:
TypeError: Drupal\search_api\Utility\QueryHelper::addResults(): Argument #1 ($results) must be of type Drupal\search_api\Query\ResultSetInterface, null given, called in /var/www/html/docroot/modules/contrib/search_api/src/Plugin/views/cache/SearchApiCachePluginTrait.php on line 186 in Drupal\search_api\Utility\QueryHelper->addResults() (line 86 of modules/contrib/search_api/src/Utility/QueryHelper.php).
Its kind of expected since the query is NULL, so the result set in https://git.drupalcode.org/project/search_api/-/blob/8.x-1.x/src/Plugin/... also becoming null.
Since previous patch is already committed, adding a second patch to fix it (excluding the changes in #9). Please review!
For people who are facing such, you need both this patch and the patch in #9 to make it work.
- last update
over 1 year ago 534 pass, 4 fail - ๐ฆ๐นAustria drunken monkey Vienna, Austria
Thanks for reporting this, that indeed seems to be a similar probolem.
However, the solution is probably to avoid caching aNULL
result in the first place, not to add a check when retrieving it.
Patch attached, please test/review! The last submitted patch, 15: 3321499-15--follow-up--views_errors_when_query_is_null.patch, failed testing. View results โ
- First commit to issue fork.
- Open on Drupal.org โCore: 10.0.11 + Environment: PHP 8.2 & sqlite-3.34last update
about 1 year ago Not currently mergeable. - last update
about 1 year ago Composer require-dev failure - last update
about 1 year ago Composer require-dev failure - Status changed to Needs work
about 1 year ago 10:14am 5 December 2023