No Results Found
Hi, Im really struggling with this - I have a very simple search form:
{exp:low_search:form required="keywords"}
Go
{if low_search_keywords_missing}Keywords are required{/if}
{/exp:low_search:form}
and a resuts page searching the channel name "position"
{exp:low_search:results
query="{segment_3}"
keywords:inflect="yes"
limit="10"
channel="position"
}
{if count == 2}
Searched for {low_search_keywords}.
Search results: {absolute_results}
{/if}
{title}
Found in {low_search_collection_label}, with a score of {low_search_score}
{low_search_excerpt}
{auto_path}
{paginate}
{current_page}/{total_pages} | {pagination_links}
{/paginate}
{/exp:low_search:results}
I have created two entries for this channel to test, one with the title "Store Assistant", and the other "Store Manager". If I search for either, or even just store I get no results and it's driving me crazy as I can't see where it could be failing?
Can anyone help
Replies
Low 6 Apr 2020 15:17
Have you created a Collection for the position channel and added a weight of 1 or up to the searchable fields, and then built the index for that collection?
Guy Roberts 6 Apr 2020 15:38
OMG, I had done neither, but have done just that and it works!
If I wanted the keyword search to search in custom fields too, would I need to do anything different, other than give the customer field an index of 1 or upwards?
Thanks for the pointer, saved me hours!
Low 6 Apr 2020 15:45
Yes, see https://gotolow.com/addons/low-search...
Guy Roberts 6 Apr 2020 16:21
The part Im struggling with, is say if you're doing a search on title and a custom field, (shown in the below image)
How can you make it specific so the resutls must match both input fields (not one or the other) Have I mis-understood the documentation on inclusive values here? https://gotolow.com/addons/low-search...
Thanks for the support!
Guy Roberts 6 Apr 2020 16:35
Or is something like this a better option?
Low 6 Apr 2020 16:35
You're probably better off using the Field Search filter rather than the Keywords filter.
The Keywords filter uses the Collection index to search and return entries, like having the searchable content of an entry in a single field. Thus you're using a single input field to target the entire entry (keywords).
The Field Search filter works like the native counterpart, and allows you to target specific fields with multiple input fields.
So, for your form, if you want to target the two fields separately, you could use two input fields like you're doing, but name them name="search:title" and name="search:contract_type" respectively.
Note that you don't need the require_all parameter here, as that only applies to multiple values of a single parameter. Parameters themselves are always combined with AND.
Also note that having low_search_keywords_missing without a keywords parameter is redundant.
Guy Roberts 6 Apr 2020 16:37
thank you so much for all your help on this - greatly appreciated!