Can I get the product category in the search so I can boost it

So if the name in the search is a match with the products category.
For example so I can add:

textClause.Tags.Add(new Tag(TagNames.Category, term) { AllowFuzzy = true, Boost = 10 });

So you can search for T-shirts and in the search result display products that belongs to the T-shirt category.

Litium version: 6.2.1

I would guess that category name isn’t available in the product index.
Maybe you could first search for categories and use the hits from that search to add boost to your optional category ids when you make your product search.

1 Like

Looks good but got too slow :frowning:

It is better to add the category names in the product index by implementing IIndexingProviderPreProcessor and rebuild the indexes when a category name has changed.

1 Like

As long as you are aware that this will affect the speed of indexing and don´t do stuff that takes a lots of time i also think this i the best solution but i don’t think that a simple product group before a product search should take that much time.

1 Like