If we have different indexes setup for each language in multilingual setup. And we delete a node. It deletes the item from current selected language related index only and all other languages still have that node untouched.

CommentFileSizeAuthor
#2 3104739-2.patch1.95 KBmiteshmap

Comments

miteshmap created an issue. See original summary.

miteshmap’s picture

Assigned: miteshmap » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.95 KB

nikunjkotecha’s picture

Status: Needs review » Fixed
jrockowitz’s picture

Priority: Major » Critical

I am reopening this issue because I am getting the below error which is related to this change. The website that is throwing this error is multilingual with the default language being English. I think the issue is that my existing Algolia indexes are NOT multiple languages. The error seems to be triggered because {MY_INDEX}_en does not exist and {MY_INDEX} does exist.

I am marking this Critical because it is throwing a fatal error. The immediate solution is to downgrade to 1.0-alpha2.

The website encountered an unexpected error. Please try again later.AlgoliaSearch\AlgoliaException: Index {MY_INDEX}_en does not exist in AlgoliaSearch\Client->doRequest() (line 1371 of /private/var/www/sites/mskcc_build/vendor/algolia/algoliasearch-client-php/src/AlgoliaSearch/Client.php).

AlgoliaSearch\Client->request(Object, 'POST', '/1/indexes/msk_doctors_en/query', Array, Array, Array, 1, 5, Array) (Line: 619)
AlgoliaSearch\Index->search('*', Array) (Line: 466)
Drupal\search_api_algolia\Plugin\search_api\backend\SearchApiAlgoliaBackend->search(Object) (Line: 468)
Drupal\search_api\Entity\Server->search(Object) (Line: 535)
Drupal\search_api\Query\Query->execute() (Line: 308)
search_api_preprocess_search_api_index(Array, 'search_api_index', Array) (Line: 287)
Drupal\Core\Theme\ThemeManager->render('search_api_index', Array) (Line: 437)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 450)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195)
Drupal\Core\Render\Renderer->render(Array, ) (Line: 226)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 227)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 67)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 49)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
nikunjkotecha’s picture

Status: Fixed » Postponed (maintainer needs more info)

Hi Jacob,

Thanks for the details.

Question: How does your search / indexation work if you are not using multi-lingual approach like described in readme?

The approach implemented is after discussion with Algolia team and would be great if you can help with bit more info around the approach you use to generalise the code in module and implement hooks / events for custom work.

Thanks,
Nikunj

jrockowitz’s picture

We currently have no multilingual search indexes set up. Algolia and Search API are just defaulting to English.

I am not seeing any multilingual approach being document in the README.txt.

When I review the recent changes there is an assumption that if Drupal is multilingual then all of related the Algolia indexes are multilingual. Without diving deeper into the code, it seems like there needs to be a method that checks if Algolia has corresponding multilingual indexes.

We are upgrading from 8.x-1.0-alpha2 below are all the changes since alpha2. I think #3053205: Support viewing results via views, support facets and autocomplete is causing this regression.

Changes since 8.x-1.0-alpha2:

  • #3104739 by miteshmap: Item is not deleted from all language indexes for Multilingual setup
  • #3060237 by nikunjkotecha: Notice for undefined $suffix when there is no sort order
  • #3059280 by nikunjkotecha: Add support for conditions with number operators
  • #3056870 by nikunjkotecha: Analytics flag always sent as false
  • #3053205 by nikunjkotecha: Support viewing results via views, support facets and autocomplete
  • #2898673 by nicola85, dabblela: Map algolia index
  • #2999933 by chipway, alonaoneill: Apply new {project}:{module} format for dependencies in info.yml
  • #2883037 by maccath: Fatal error thrown when requests to Algolia fails
jrockowitz’s picture

BTW, now that I have investigated this issue further. This is probably the wrong ticket and a new ticket needs to be created for this regression. Do you want me to create a new ticket?

nikunjkotecha’s picture

Yes, I suspected that and that's why I asked for more details

And my bad, I added that to INSTALL
https://git.drupalcode.org/project/search_api_algolia/blob/8.x-1.x/INSTA...

I think yes, we need a new ticket to make language suffix a configuration instead of simply assuming that's the best approach.

jrockowitz’s picture

Priority: Critical » Major
Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

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