Magento - Exclude Search Term - magento

Does anyone know if there is any way to exclude certain words from being searched for in Magento?
For example: Say I have a store that sells hats, I want to exclude the word “hats” from being searched, so if someone searches for “black hats” the it would only return results for “black”, because all the products are hats anyway, and if it allowed “hats” in the search term then it would return ALL hats.
Any ideas?

I am not sure you really need to do this, given the scenario you outlined. Magento uses like or fulltext as available search options (set via admin > system > configuration > catalog > catalog search), and neither of those would return all hats if the search query was "black hats."
If you still feel the need to exclude certain search terms, you could either extend app/code/core/Mage/CatalogSearch/Model/Query.php in the local code pool, and add a method that removes any unwanted search terms. Or - and this is the approach I would take - create a small module with an observer that catches the controller_action_predispatch event. This would allow you to sanitize/modify the query parameters to remove any search terms that should excluded, before the query ever gets passed to the ResultController.php.

Related

When is it appropriate to use tensor-based DBs (e.g Marqo) instead of keyword based (e.g Elasticsearch)?

I'm implementing end user search for an e-commerce website. The catalogue contains images, text, prices of different items. LLMs are all the hype at the moment but I'm not sure how well proven the performance is in comparison to keyword based for e-commerce.
I've tried tensor based search and it appears to perform well but its hard to benchmark search against relevance so I'm not sure of putting it into production.
What frameworks are people using to determine when you use tensor/vector based search vs keyword based?

Relevancy searching in elastic search,

Currently i am implementing product search in my application using elastic-search,i was able to implement basic search by applying steamers(to get root terms) and analyzers(remove 's' and stuff like that), but when searching for products like "Red Shrimp" i am getting "red shrimps" , "shrimps" and also some unrelated products which contain "Red"(Red gram,Red onion,Red battey) which shouldn't happen.
Can any one suggest me how to eliminate this irrelevant section of results,I am grateful to any valid suggestion.
Thanks,
I
you can use elastic "Common Terms Query" with minimum_should_match option
Reference Link : https://www.elastic.co/guide/en/elasticsearch/reference/6.1/query-dsl-common-terms-query.html

Wild card searches with query_string

Is it possible to enable wild card queries by default using query_string?
I'm having to manually append * to each of the terms. I had a look at the documentation but couldn't find anything.
No there is no way to enable it. You can enable/disable using wildcards "allow_leading_wildcard" the way how it works, that ES try to match tokens. So if you search for car it will match car until you search car* then it will match cars (sure it depends on analysis but further there is link for you to read).
I dont know case what you want to do but you should look to dealing with language. It should help also note that using leading wildcard could have performance issues that is why sometimes is better to disable it.

Multiple synonym(s) for search terms

I'm in need to have more than 1 synonym for a search term in magento (version 1.4.2.0 - can't upgrade it for now), but all my attempts to add multiple synonyms have failed.
I've been looking around without any solution, any of you had a similar need and managed to find a solution?
Thanks for any help,
Mat.
So you have people look for 'doodad' or 'dodad' and you want to show people the 'macguffin' instead.
So far you have tried to add these search terms in on the back-end but it has not worked.
The fix-workaround is surprisingly simple.
Type in 'dodad' in the frontend - no result given.
Now type 'doodad' in the frontend - again no results.
Now go into the backend and go to the last page of the search terms.
The entries for 'dodad' and 'doodad' will be in there. You can now put 'macguffin' in the synonym box.
Now go to the front and type in 'dodad' or 'doodad' into the search box and it will take you straight to the 'macguffin' item.

How to search usenet for programming questions?

I've been using usenet searches since about 1995 to get programming information, mostly for microsoft APIs. First searching via dejanews, and now google "groups" which bought out dejanews. Over the last few years I've noticed a steady decline in the quantity of search results for usenet from google, and today I find I'm completely unable to get a working usenet search on their advanced group search page. I'm used to searching on "microsoft.*" sometimes suplemented with "microsoft" or "microsoft*". Just try to find a post from 1996-1998 time period on "database" in either the comp.* or microsoft.* hierarchies, and if you can do it, please show your search expression. There should be thousands of results.
http://groups.google.com/groups/search?safe=off&q=database+group%3Amicrosoft*&btnG=Rechercher&as_mind=1&as_minm=1&as_miny=1996&as_maxd=1&as_maxm=1&as_maxy=1999&as_drrb=b&sitesearch=
seems to work nicely... 994 results (no thousands but still...)
It appears to be problem with the advanced search form. I can't get the one at
http://groups.google.fr/advanced_search?hl=fr&q=&hl=fr&
to work either. But I can use the basic form with "database group:microsoft*" and I get many results as expected.
http://www.google.ca/groups/search?safe=off&q=database+group%3Acomp.*&btnG=Search&sitesearch=
returns 3,000 results
The advanced search isn't working for me either:
Broken advanced search results URL
However, removing lr=selected from the query string in that URL makes it work, for some reason:
Working advanced search results URL
In fact, hitting the search button again on the broken advanced search results page will return those results as well for me.
Or actually, it's only partly working, since entering multiple comma-separated groups in the advanced search form (or using the group: search operator) doesn't quite work as expected and ends up adding all the words in the additional group names as search keywords too.
You could try learning Julian dates and use the daterange search operator:
Search results using daterange:

Resources