When I add a "Item language" filter with the "Interface text language selected for page" option, I get the following notice:
Notice: Undefined offset: 0 in Drupal\search_api_solr_multilingual\Plugin\search_api\backend\AbstractSearchApiSolrMultilingualBackend->alterSearchApiQuery() (line 155 of modules/contrib/search_api_solr_multilingual/src/Plugin/search_api/backend/AbstractSearchApiSolrMultilingualBackend.php).

The filter seems to work though. If I expose the filter for users to select, then there is no notice and it works also.

Comments

mErilainen created an issue. See original summary.

merilainen’s picture

Assigned: Unassigned » merilainen
Status: Active » Needs review
StatusFileSize
new996 bytes

I think the logic has to be inverted when checking if the query has "views" tag. Seems to work fine with the patch.

But I think it would be more intuitive to let site-builder just add a "Item: Language" filter in the views which works also, it just gives the notice I mentioned in the issue description.

drholera’s picture

StatusFileSize
new852 bytes

I think the main problem is we try to get the first element in an array just like $array[0] instead of reset() function. This patch may fix it.

mkalkbrenner’s picture

#3 is the correct solution since the language support changed within Search API.

mkalkbrenner’s picture

  • mkalkbrenner committed 90a2102 on 8.x-1.x authored by drholera
    Issue #2821699 by mErilainen, drholera, mkalkbrenner: Notice: Undefined...
mkalkbrenner’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.