1283 Posts
Bucklash
5 years ago
2
Topic

Hi Folks

This might be helpful to those getting funky with searches....

SCENARIO Searching for articles where some value is stored in a custom_field as comma separated values i.e.

Article 1:
id: 123
custom_field: a,b,c<br>
Article 2:
id: 234
custom_field: b,c,d<br>

So in search form, have a field...

type: select (dynamic or  simple etc)
storage: custom_field
options: first=a,second=b, etc (or have options based on db query etc)

So now search field is set up to allow user to search for articles based on values stored in ‘custom_field’.

MATCH

We need to alter the fields 3/Match setting. 

Getting your head round Match is really important.

With 3/Match selected:

  • Change custom_field to ‘any words exact’. It was probably on ‘permissive (default).
  • With ‘any words exact’ selected, click the cross (+) next to it to reveal modal window.
  • There will be a couple of things to choose from. 
  • All we are interested in is changing Comparison Mode from ‘Simple’ to ‘Multiple’.
  • Compare the SQL query before and after using debug (found in template's configuration area)
Get a Book for SEBLOD
15 Posts
Oreovanila
5 years ago
1
Level 1

I think I must say thankyou for your post Bucklash. it solve my problem

actually my case is differnt.

Article 1:
id: 123
custom_field: 2,10,45
Article 2:
id: 234
custom_field: 32,10,45

when I select (in search form) value 2 (on custom_field), will list article 1 and 2. (with MATCH permisive)

because in article 2 contain number 32 (wich is contain number 2). Its not what I desired.

So follow your post, I set MATCH ‘any words exact’ and + sign to changing Comparison Mode from ‘Simple’ to ‘Multiple’. 
Solve my problem. Result now only article 1 only.

I dont know its the right 'trick' to do or not, but it solve my problem. Thanks

1283 Posts
Bucklash
5 years ago
0
Level 2

Yeah, I discovered this a while back and then later couldn’t figure out how I did it... and then found it again.... 

Seblod can be damn tricky and confusing...

Best thing to do with searches is put debug on and play around with match settings.... 

compare searches and speed of results

Get a Book for SEBLOD