About The Multisearch.php
6 posts by 3 authors in: Forums > CMS Builder
Last Post: May 18, 2017 (RSS)
By Tom - April 3, 2017
Hello,
A question about the multisearch.php
Currently the search field is something like this
'searchFields' => array('ref_no','title_text','studio'),
The question is about the ref_no.
The reference number we stored in the db is something like this
abc123, sss345
The multisearch runs perfect if the user search abc123, abc, abc1
however, if the user search abc-123,
there is no result found.
Please advice is it possible if the user search abc-123,
then the result of abc123 will be shown.
Thanks a lot.
By Damon - April 10, 2017
Hi Tom,
There is no fuzzy logic searching but you can get same results by entering keyword variations to each record.
What you could do is:
1. create a textbox or textfield in that section editor for search variation keywords.
2. add in the possible variations that users may search for: abc-123, abc123 etc
3. the last step is to add the keywords field name to the 'searchFields' array.
Try this out and let me know if you have any questions.
Thanks!
Damon Edis - interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
By Tom - May 15, 2017 - edited: May 15, 2017
Hello,
Sorry for trouble again.
I have created a field named ref_no1
And I intend to update the ref_no1 from ref_no
For example
In ref_no
ABC123
Then in ref_no1
ABC-123
I know how to do it in php
<?php
echo preg_replace('/^([A-Za-z]+)([0-9]+)$/i', '$1-$2', $listingsRecord['ref_no']);
?>
However I really don't know how to do it in mysql console to update the ref_no1 column.
Please advice.
Thanks a lot
By Dave - May 18, 2017
Hey Tom,
As an alternate approach, if dashes aren't needed and you're always searching for ref_no values what about just removing dashes from the keyword the user searches for? So if they search for ABC-123 or ABC123 or -ABC123- it all searches for ABC123?
$searchOptions['keywords'] = str_replace('-', '', @$_REQUEST['q']); // remove dashes
Hope that helps.
interactivetools.com