- Status changed to Needs review
almost 2 years ago 4:10pm 19 January 2023 - Status changed to Needs work
almost 2 years ago 3:30pm 27 January 2023 - 🇧🇪Belgium herved
I also stumbled on this while evaluating the module for one of our projects.
The patch resolved the error but I think\Drupal\search_api_best_bets\Plugin\search_api_best_bets\query_handler\Solr::alterResults
relies on the "[elevated]" field to be there to mark a result as elevated, needed if "Retrieve result data from Solr" is disabled (which I always keep disabled because solr documents can contain a large amount of data, especially using search_api_attachments or file_extractor).
This could be solved by storing elevated items in the query options instead.In the end, I decided to create my own processor. Nevertheless thanks for this module as it gave me a great head start.
The approach is slightly different as it queries Solr itself, which is IMO not only faster but also more flexible as you can choose the fields and also field types used in Solr (string/fulltext/fulltext tokens,...).
Here's the implementation if interested: https://gist.github.com/vever001/87b390f75397990535d72b689abd714a - 🇦🇺Australia bradtreloar
The NullPointerException is thrown because Solr is trying to get the unique key from the list of fields returned by the query.
The default
uniqueKey
field isid
. Adding it to the field list fixes the error.// Add the documents ids to be elevated to the search query. if (isset($query_item_ids['elevate']) && is_array($query_item_ids['elevate'])) { $query->setOption('solr_param_elevateIds', implode(',', $query_item_ids['elevate'])); $query->setOption('solr_param_fl', 'id,[elevated]'); }
- Status changed to Needs review
over 1 year ago 11:20pm 29 May 2023 - 🇺🇸United States smustgrave
Can anyone confirm #24 that's seeing the issue?
- 🇫🇮Finland hartsak
Thanks for the fix! I just encountered this issue in my project and the fix in #24 solved my problem.
- @smustgrave opened merge request.
-
smustgrave →
committed f6896391 on 2.0.x
Issue #3124980: java.lang.NullPointerException when searching for term
-
smustgrave →
committed f6896391 on 2.0.x
- Status changed to Fixed
over 1 year ago 9:05pm 9 June 2023 Automatically closed - issue fixed for 2 weeks with no activity.