195 Posts
1 month ago

Dear SEBLOD Team

I have a suggestion for a small yet very powerful improvement to the Search Query plugin


[MATCH] syntax in standalone queries uses only default permissive Match Mode which is very limiting.


Here is an example of my standalone list with 4 filers (permissive, exact, date_future, date_past)

Here is the Match settings in the query

AND [MATCH]v.room_id||$uri->getValue('room')[/MATCH]

AND [MATCH]v.registered||$uri->getValue('date_start')[/MATCH]

AND [MATCH]v.registered||$uri->getValue('date_end')[/MATCH]

AND [MATCH]v.full_name,v.email||$uri->getValue('keyword')[/MATCH]

However, this is the result. There are no results as all Match operators are LIKE %%


My solution is based on adding a third part into the Match syntax defining the desired match mode.

AND [MATCH]v.room_id||$uri->getValue('room')||exact[/MATCH]

AND [MATCH]v.registered||$uri->getValue('date_start')||date_future[/MATCH]

AND [MATCH]v.registered||$uri->getValue('date_end')||date_past[/MATCH]

AND [MATCH]v.full_name,v.email||$uri->getValue('keyword')[/MATCH]

And make a small “one-row” change in the Search Query plugin

This is the place where query parts are generated. Search Query field has empty $field->match_mode of course, that’s why it generates a permissive match for each occurrence of [MATCH] in the query string (row 180)

$sqls[] =JCck::callFunc_Array( 'plgCCK_Storage'.$storage, 'onCCK_StoragePrepareSearch', array( &$field, $field->match_mode, $def[1], $name, $name2, $p, array(), &$config ) );

Now as [MATCH] items have also a third part defining the match mode. If it exists, it will be used as a match mode selector in the StoragePrepareSearch process.

$prop_match_mode = (empty($def[2]))?$field->match_mode:$def[2];

$sqls[] = JCck::callFunc_Array( 'plgCCK_Storage'.$storage, 'onCCK_StoragePrepareSearch', array( &$field, $prop_match_mode, $def[1], $name, $name2, $p, array(), &$config ) );

This is the correct result.

I would like to ask you if you would consider implementing this solution. It is a miniature change and has no side effects. If the match mode is not defined in the syntax or non-existing value is added, the function works as before because the permissive mode will be selected as default option.



Get a VIP membership