Score:0

Solr autocomplete does not work for Product Variations

uz flag

I am trying to create a sitewide search using Solr. For this, I indexed Product Variations and Content entities as Rendered HTML Output. When I try to search for a content entity, the autocomplete works and gives me the results, but it fails to give the results for Product Variations. The search itself works both for Content and Commerce entities. I am using Search API Solr with version 4.2 and Search API Autocomplete with version 1.7.

Score:2
gt flag

Search API autocomplete requires a canonical links for entities to build suggestions list. Even if there is a result from index server, if it can't build a link, this result will be ignored. In your case, product variation simply doesn't have a canonical link, see https://git.drupalcode.org/project/commerce/-/blob/8.x-2.x/modules/product/src/Entity/ProductVariation.php#L79-90 Adding a canonical link will fix the issue. I have found a patch here https://www.drupal.org/project/commerce/issues/3025860#comment-14597209

Alfred Armstrong avatar
cn flag
Search API autocomplete _can_ be configured so that the selections are simply search keywords, not direct links to the entities. It depends on which suggester is used.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.