Hi. On 1.5.2.1 ur mod working normally.Qphoria wrote:Ok .. so AND may be a better choice here. As it does seem to improve results, but needed some more tweaks.
On my site I have a product called "Migs Payment Integration"
With 1.4.x the search for "Migs Integration" found 0 results because it was exact phrase matching. No good.
With 1.5.x "OR", the search for "Migs Integration" found 4 pages of results, and the correct item was bottom of page 2. No good.
With 1.5.x "AND", the search for "Migs Integration" found just the one correct result.
So that is definitely improved.
However, it could still be limiting if you don't have all the necessary terms in the product name. But using tags correctly should resolve that.
If I searched "Payment Integration" it would find all products with "Payment" AND "Integration"
But wouldn't find ones like "Offline Payment System". However, if you use tags and have tags like "Payment, Module, Extension" and leave the TAG search as "OR", then that combination should match everything you need.
So to make it clear, the search logic becomes:
1. Find all products that match "Payment" AND "Integration", which finds all products with those 2 words in the name/description.
2. Additionally, find products that have tags "Payment" OR "Integration" in the tag area, which finds all products that have matching tags, picking up the few that didn't have payment integration in the name/description, but partially matched the tags.
I think we need to add mysql fulltext searching to the database for a more proper solution.... But for now, the quick solution appears to be replacing OR with AND, which I think a lot of people have already figured out in other threads, but hey.. i'm late to the party. But I bring other bug fixes as well. I found that the 1.5.1.3 tag search is actually bugged because it explodes the words, but searches the full phrase, causing tags to be completely broken in 1.5.1.3 without this fix. This AND/OR combination also requires a parenthesis change to work properly.
I've attached the default 1.5.1.3 catalog model file with all changes
Drop it into catalog/model/catalog folder and replace the existing product.php file
OR
To manually make the change and the bug fix yourself:
1. EDIT: catalog/model/catalog/product.php
2. FIND:It should match 4 times.Code: Select all
$sql .= " " . implode(" OR ", $implode) . "";
3. Change ONLY the FIRST and THIRD instances to:This leaves the tag search as "OR" but the name/description search as "AND".Code: Select all
$sql .= " " . implode(" AND ", $implode) . "";
4. FIND (TWICE):5. REPLACE BOTH WITH:Code: Select all
$sql .= " OR ";
6. TAG BUG FIX, FIND (TWICE):Code: Select all
$sql .= ") OR (";
7. REPLACE BOTH WITH:Code: Select all
$this->db->escape(utf8_strtolower($data['filter_tag']))
8. Delete all files in your system/cache folder via FTPCode: Select all
$this->db->escape(utf8_strtolower($word))
9. Now try your searches and see if they've improved.
Again, you may need to use the right combination of tag and title. For my example
If I have a product called "Offline Payment System"
and I want the search for "Payment Integration" to match, I would need to use tags like:To guarantee matching more common words that may not all be in the name/descOffline, Payment, System
This seems to be a great improvement on my site. Let me know how it works on your site.
DO NOT USE THIS FILE UNLESS YOU ARE USING v1.5.1.3
FUTURE VERSIONS WILL ALREADY HAVE THIS FIX AND OTHER CHANGES.
OLDER VERSIONS MAY HAVE DIFFERENT CHANGES AND MAY NOT BE COMPATIBLE WITH THIS FILE.
I installed today 1.5.3.1 - cleary - stock search doesnt work normal (like in first post need).
I made changes in code like u say - but have little issuse.
Search now work normal but pagination says i have search result to 10 pages but search found only 8 products ( about 8 - its ok. search work normally). So how to fix pagination ?
