Home › Toolset Professional Support › [Closed] I need to convert a full text search to a word search
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
This topic contains 7 replies, has 1 voice.
Last updated by Christopher Amirian 4 weeks ago.
Assisted by: Christopher Amirian.
Tell us what you are trying to do?
I have a View that does a full text search I need to convert this search to a word search - how do I do that?
This is the Search and pagination:
[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group first">
<label style="margin-left: -2vw" for="wpv-wpcf-eng-name">[wpml-string context="wpv-views"]English known plant name[/wpml-string]</label>
[wpv-control-postmeta field="wpcf-eng-name" placeholder="Type known name & press Enter" url_param="wpv-wpcf-eng-name"]
</div>
<div class="second" style="display: none">
[wpv-filter-submit name="Search " output="bootstrap" class="btn-secondary"][/wpv-filter-controls]
</div>
[wpv-filter-end]
This is the Loop editor:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<div class="popup" id="popup">
<p>Click name in list to view plant</p>
<ul class="wpv-loop js-wpv-loop eng-name-lst">
<div id="scollable">
<wpv-loop>
</wpv-loop>
</div>
<button class="sml-btn" onclick="closePopup()">Close</button>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<p style="width: 20vw; margin-top: -2vh; float: left">
[wpml-string context="wpv-views"]No items found[/wpml-string]
</p>
[/wpv-no-items-found]
[wpv-layout-end]
What is the link to your site?
hidden link
Hi,
Welcome to Toolset support.
To convert your current exact match search into a partial (word-based) search within Toolset Views, you can integrate the Relevanssi plugin, which enhances WordPress search capabilities, including partial matching in custom fields.
Steps to Implement Partial Matching:
Install and Activate Relevanssi:
- Navigate to your WordPress dashboard.
- Go to Plugins > Add New.
- Search for Relevanssi.
- Click Install Now, then Activate.
Configure Relevanssi Settings:
- After activation, go to Settings > Relevanssi.
- Under the Indexing tab:
- Ensure your custom post types (e.g., the one containing the 'eng-name' field) are selected for indexing.
- In the Custom Fields section, add the slug of your custom field (e.g., wpcf-eng-name) to the list of fields to index.
- Click Save the options.
- Click Build the index to index your content.
Adjust Your Toolset View:
- Edit the View responsible for displaying your search results.
- In the Search and Pagination section, remove the specific custom field filter for 'eng-name'.
- Add a Text search filter instead.
- In the filter settings, choose to search in Title, body, and custom fields.
For more information:
https://toolset.com/course-lesson/searching-texts-in-custom-fields-with-toolset-and-relevanssi/
Thanks.
With this text search:
<div class="form-group">
<label for="wpv-post-search">[wpml-string context="wpv-views"]English Common name[/wpml-string]</label>
[wpv-filter-search-box placeholder="type English Name and press Enter/Go" url_param="wpv-wpcf-eng-name"]
</div>
And rebuilding Relevanssi indexes
The search no longer works
Hi,
Once you installed the relevanssi plugin you will then need to remove your existing text search and then re-add it.
Upon re-adding the text search filter you should be presented with 3 options, one of which will include the ability to have the custom fields as a part of the search filter.
Do you follow the steps mentioned in the documentation?
Thanks.
How do I remove a text search and re-add it?
Hi Christopher,
After alot of fumbling around, deleting different parts of the text search, I ended up with 2 input fields - Search box 1 and Search box 2, I need to fill both input fields with the same word for the search to work and produce a list of clickable results.
This is the Text Search in Search and Pagination section:
[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group first">
<label style="margin-left: -2vw" for="wpv-wpcf-eng-name">[wpml-string context="wpv-views"]Search box 1[/wpml-string]</label>
[wpv-control-postmeta field="wpcf-eng-name" placeholder="Type known name & press Enter" url_param="wpv-wpcf-eng-name"]
<div class="form-group">
<label for="wpv-post-search">[wpml-string context="wpv-views"]Search box 2[/wpml-string]</label>
[wpv-filter-search-box placeholder="Type word, press Search" output="bootstrap"]
</div>
</div>
<div class="second">
[wpv-filter-submit name="Search " output="bootstrap" class="btn-secondary"][/wpv-filter-controls]
</div>
[wpv-filter-end]
Please could you correct it to display only 1 input field.
Many thanks
and this is the Loop editor that displays the results:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<div class="popup" id="popup">
<p>Click name in list to view plant</p>
<ul class="wpv-loop js-wpv-loop eng-name-lst">
<div id="scollable">
<wpv-loop>
</wpv-loop>
</div>
<button class="sml-btn" onclick="closePopup()">Close</button>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<p style="width: 20vw; margin-top: -2vh; float: left">
[wpml-string context="wpv-views"]No items found[/wpml-string]
</p>
[/wpv-no-items-found]
[wpv-layout-end]
Please could you correct it to display only 1 input field.
Many thanks
Hi David,
Thanks for the update and the clarification.
From your current setup, it looks like you have both a specific custom field filter (wpcf-eng-name) and a general text search filter added to your View. When using Relevanssi for partial word matches, you should only use the Text Search filter, not the custom field one — otherwise, both fields must match to return a result (as you're experiencing).
Please remove the [wpv-control-postmeta] line completely, and only use [wpv-filter-search-box].
Here is the corrected version of your Search and Pagination section:
[wpv-filter-start hide="false"] [wpv-filter-controls] <div class="form-group first"> <label for="wpv-post-search">[wpml-string context="wpv-views"]Search English plant name[/wpml-string]</label> [wpv-filter-search-box placeholder="Type known name & press Enter" output="bootstrap"] </div> <div class="second"> [wpv-filter-submit name="Search" output="bootstrap" class="btn-secondary"] </div> [/wpv-filter-controls] [wpv-filter-end]
Notes:
- The [wpv-filter-search-box] will use Relevanssi to search post titles, content, and indexed custom fields (like wpcf-eng-name) as long as you've included that custom field in the Relevanssi indexing settings.
- Go to Relevanssi → Settings → Indexing and make sure wpcf-eng-name is added to the list of custom fields to index.
- Rebuild the index after saving.
Thanks.
The topic ‘[Closed] I need to convert a full text search to a word search’ is closed to new replies.