quicksearch $equals instead of $starts

We have a module where we have the quicksearch searching on two fields. One is a varchar the other is an integer. Is there a way to force the integer field to use $equals instead of $starts? The $starts generates a sql query using 'LIKE' instead of '=' which converts all the integers to strings and adds a lot of unnecessary overhead to the query. If I run the query with = it runs in .00026 seconds where as LIKE takes 6.1 seconds.

'quicksearch_field' => array(
   0 => 'name',
   1 => 'customer_number',
'quicksearch_priority' => 1,

Can anything be added to the above code to force $equals in customer_number?

  • Hi Ryan Horton,

    Unfortunately, there is no such setting or configuration available at the metadata level (as I searched through the code base).

    Looking at the filter model, it always use "$starts" operator for quicksearch fields.

    I checked in modules/Filters/clients/base/datas/model/model.js => buildSearchTermFilter function

    Then, I tried replacing it with '$equals' and it worked. But I am afraid that you might need to override this file to add some condition like for particular module or particular field, use "$equals" operator instead of "$starts".

    I haven't tried overriding it in custom directory but I believe it would be similar to how we override other sidecar components though it is a data bean.

    Hope, this would serve as a good starting point to drill down further.

    Let us know how it goes or if you find any better way to resolve this.