Searching Multiple Fields - Only Returning Last Field
3 posts by 2 authors in: Forums > CMS Builder
Last Post: September 29, 2016 (RSS)
Hi there,
Having an issue with searching through multiple fields. Seems like only the last field is being used in the search because when I added a new field called keywords (used for misspellings) to the end I find that only that field brings back results:
name="yacht_title_query,meta_description_query,intro_query,yacht_name_query,keywords_query"
Only content in the keyword field is returned. Example search where there is content in "keyword" field:
Example search with no results where keyword is blank but should pick up the yacht name from "yacht_name":
I have attached the search file as well.
By ross - September 29, 2016
Hi there.
Thanks for posting.
The issue here is the "_query" suffix after each field name.
You actually only need it on the last one like this:
name="yacht_title,meta_description,intro,yacht_name,keywords_query"
Give that shot and let me know how you make out.
Note: You need to make sure you have allowSearch enabled in your getRecords call like this:
list($sample_multi_recordRecords, $sample_multi_recordMetaData) = getRecords(array(
'tableName' => 'sample_multi_record',
'loadUploads' => true,
'allowSearch' => true,
));
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com
Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/