332 Posts
Kenneth
6 years ago
Topic

Hi,

I've setup a generic search field with match "each word". 

In the generic search field I've added some fields:

Title, meta description, fulltext, category and a custom field.

I can get hits when the words used for search is in the same field I'm searhinig, but it does not search accross fields (IF one word is in title and the other is in meta etc).

If I set match to permissive, I do get the hit, but it only cares about one of the words as well and brings in other hits that dosn't have both words.

If I set match to each word it again goes back to the strict standards of needing the words to be found in the same field, and not accross fields.

Get a VIP membership
332 Posts
Kenneth
6 years ago
3
Level 1

This is from debug:

  AND (((t1.title LIKE '%liten%') AND (t1.title LIKE '%cx%')) OR ((t1.metadesc LIKE '%liten%') AND (t1.metadesc LIKE '%cx%')))

As I can understand from this it only gives me results if all keywords is used in the same field (title or metadesc) but not when one keyword is matching title and another is matching metadesc.

I belive if the query would be like this, it would make more sense?

AND ( ((t1.title LIKE '%liten%') OR (t1.metadesc LIKE '%liten%')) AND ((t1.title LIKE '%cx%') OR (t1.metadesc LIKE '%cx%')) )

332 Posts
Kenneth
6 years ago
2
Level 2

The searc done above has two keywords:

liten cx

4229 Posts
Kadministrator
6 years ago
1
Level 3

To get second for each field you need to use any words. But I doubt you can set it to AND between the fields, search generic is not so refined.

332 Posts
Kenneth
6 years ago
0
Level 4

But any word just dosn't make any sense, because the more words you add the more hits you will get. 

Could it be a feature request or something to make search generic adapt the pattern suggested?

I belive if the query would be like this, it would make more sense?

AND ( ((t1.title LIKE '%liten%') OR (t1.metadesc LIKE '%liten%')) AND ((t1.title LIKE '%cx%') OR (t1.metadesc LIKE '%cx%')) )
332 Posts
Kenneth
6 years ago
1
Level 1

I just had an idea about this.

What if I take use of SD Field Concat, and store all the fields I want to search within in a new hidden field, and then direct the search to look in this field. Will that work?

I see a couple of hours needed to get this working, but I belive it will solve it. 

Thoughts??

332 Posts
Kenneth
6 years ago
0
Level 2

This solved the issue. I use concat field to gather all values I want to search in a new field (i altered this tor varchar(2048)) to allow much storage for this field, and I edit the items - voila - all values are stored in a single field which I now search, and it works as expected. 

4229 Posts
Kadministrator
6 years ago
0
Level 1

Thank you for reporting back.

Get a VIP membership