- π¦πΉAustria drunken monkey Vienna, Austria
Makes sense, thanks for posting!
Committed. -
drunken monkey β
committed 35731d58 on 8.x-1.x authored by
bogdan.dinu β
Issue #3323594 by bogdan.dinu, drunken monkey: Fixed deprecation warning...
-
drunken monkey β
committed 35731d58 on 8.x-1.x authored by
bogdan.dinu β
- Status changed to Needs work
about 2 years ago 8:23am 9 February 2023 - π©πͺGermany mkalkbrenner π©πͺ
Since the commit of this patch, the search result highlighting integration tests of search_api_solr are failing.
- π©πͺGermany mkalkbrenner π©πͺ
Undefined array key "manu"
in
/home/runner/work/search_api_solr/search_api_solr/drupal/modules/contrib/search_api_solr/tests/src/Kernel/SearchApiSolrTechproductsTest.php:54// Test processor based highlighting. $query = $this->buildSearch('Technology', [], ['manu']); $results = $query->execute(); $this->assertEquals(1, $results->getResultCount(), 'Search for Β»TechnologyΒ« returned correct number of results.'); /** @var \Drupal\search_api\Item\ItemInterface $result */ foreach ($results as $result) { $this->assertStringContainsString('<strong>Technology</strong>', (string) $result->getExtraData('highlighted_fields', ['manu' => ['']])['manu'][0]); $this->assertEmpty($result->getExtraData('highlighted_keys', [])); $this->assertEquals('β¦ A-DATA <strong>Technology</strong> Inc. β¦', $result->getExcerpt()); }
- π©πͺGermany mkalkbrenner π©πͺ
I just verified that reverting the patch lets the test pass again and "Technology" is highlighted again.
- Status changed to Needs review
about 2 years ago 5:18pm 9 February 2023 - π©πͺGermany mkalkbrenner π©πͺ
In case of "foreign" indexes like Search API Solr Document datasources or Drupal multisite searches, the value could be NULL. In this case the backend is responsible to modify the highlighted_fields extra data later if it allows to use the highlight processor.
Therefore, we must not remove the information about the field that "should" be highlighted at this point. Converting the value into an empty string is the backward compatible behaviour of this processor. -
drunken monkey β
committed 0868439f on 8.x-1.x authored by
mkalkbrenner β
Follow-up to #3323594 by mkalkbrenner, drunken monkey: Fixed regression...
-
drunken monkey β
committed 0868439f on 8.x-1.x authored by
mkalkbrenner β
- Status changed to Fixed
about 2 years ago 6:54am 10 February 2023 - π¦πΉAustria drunken monkey Vienna, Austria
Thanks for noticing and posting a patch, and sorry for breaking your stuff again. ;)
Patch looks good β committed.
Thanks again! - Status changed to Needs review
about 2 years ago 8:46am 11 February 2023 - π¦πΉAustria drunken monkey Vienna, Austria
Whelp, spoke too soon. Problem is actually that
$value
can be an object of type\Drupal\search_api\Plugin\search_api\data_type\value\TextValue
at this point. Whilepreg_split()
doesnβt seem to have any problems accepting that as itβs second parameter (for some reason), it of course fails theis_string()
check, letting its value be ignored.
Instead of all the above, letβs just explicitly cast$text
to a string inhighlightField()
, which should also handleNULL
values correctly.Patch attached (plus interdiff compared to version before any of the patches here was committed), please test/review!
-
drunken monkey β
committed d1999726 on 8.x-1.x
Follow-up to #3323594 by mkalkbrenner, drunken monkey: Fixed regression...
-
drunken monkey β
committed d1999726 on 8.x-1.x
- Status changed to Fixed
about 2 years ago 8:49pm 12 February 2023 - π¦πΉAustria drunken monkey Vienna, Austria
Seems to work, so: committed.
- πΊπΈUnited States ghalusa
- Installing drupal/search_api (1.28.0): Extracting archive
- Applying patches for drupal/search_api
https://www.drupal.org/files/issues/2023-02-11/3323594-13--fix_bc_break_... β (3323594: PHP 8.1 deprecation warning preg_split)
Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2023-02-11/3323594-13--fix_bc_break_... β Automatically closed - issue fixed for 2 weeks with no activity.