4

I'm looking for a way to manually force certain search results for certain search queries.

For example, if the customer searches for "T-Shirt", I'd like to be able to manually select 4-5 products that I'd like to show as the first search results for that search query, even though they might have nothing to do with T-Shirts at all. After that, Magento's default search results should appear.

Even though there are a lot of searching extensions, none seem to offer what I have in mind.

2 Answers 2

5
+50

A wild idea. Not sure if it will work, but you can give it a try.
It's simple and not very time consuming.
The search works like this.
The attributes you marked as searchable are indexed in the table.
The search model then performs queries on this table using LIKE or fulltext search, depending on how you set it.

now my idea:
You can create a new product attribute (type textarea) and make it searchable.
This attribute should not be displayed anywhere. You can call it something like search_bias or something similar to remember what is for.
Then, for the products you want to appear at the top for the search T-shirts enter the word T-shirts a few times in this field, save an reindex.

This way maybe these products will have a better relevance when searching for T-shirts

5
  • 1
    Great minds... :) Aug 11, 2015 at 9:02
  • Thanks, I'm actually currently trying something like this. Instead of spamming the field with the intended search terms, I'm using a search extension that offers a "weight" for each field. My hope being that if I enter a high enough weight for the search_bias field, these results will show up at the top...
    – Louis B.
    Aug 11, 2015 at 9:02
  • @LouisBataillard. if you have weight on fields it should be even better. It should work.
    – Marius
    Aug 11, 2015 at 9:07
  • @fschmengler. LOL...this isn't the first time this happens.
    – Marius
    Aug 11, 2015 at 9:07
  • This ended up working just as described. I used a searching extension to add a high weight to the new search_bias field, and now I can enter search terms into these fields for which a product should appear at the top of the search results!
    – Louis B.
    Aug 11, 2015 at 9:54
5

You could create a new text area attribute "search_boost", make it not visible in the frontend but searchable and use it to add search terms where this product should show up.

With the default Magento search you cannot control the search order directly (see: How to control search result ordering), but if you use "fulltext" or "combined" mode, you could enter a value like T-Shirt T-Shirt T-Shirt T-Shirt T-Shirt T-Shirt T-Shirt T-Shirt T-Shirt T-Shirt in the "search_boost" attribute to give the product more relevance for a "T-Shirt" search.

Some search extensions allow specifying a "boost" or "weight" value for attributes, in this case you can enter a very high value for the "search_boost" attribute instead of repeating the search term.

1
  • I've actually had a very similar idea (see my comment to @Marius answer below). I will update my question if it should work.
    – Louis B.
    Aug 11, 2015 at 9:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.