I currently have a search box which returns results, but only seems to return results if the search term is an exact match. For example, if i search hospital I will get 5 results back with the name hospital in the title, but if i search hospitals i will get no matches found. I would like the search to return results that are close to the search term as well. This is how i have it set up.
This is my search box. It returns to the same page as my index page has an {% include "components/search" %}
to display on the homepage.
<form class="navbar-search" action="{{ url('') }}">
<div class="input-group add-on">
<input class="form-control" placeholder="Search" name="q" id="srch-term" type="search">
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
Then my search component is this:
{% set query = craft.request.getParam('q') %}
{% paginate craft.entries.section('Organizations').search('title:' ~ query).order('score').limit(10) as entries %}
{% if entries|length < 1 %}
{% paginate craft.entries.section('Organizations').search('organizationSummary:' ~ query).order('score').limit(10) as entries %}
If the title returns no search results I wanted it to search through a summary section instead. Currently it works very well except for only returning exact terms. I'm a bit stuck as I'm ordering by score as shown in the Craft documentation so not sure what I am missing here. Any ideas?
Thanks