How to define custom results for a queryIn this post, we will show you how to use the Site Search 360 query mapping editor to easily create custom search results for a certain query or queries.
You can find the query mapping editor in the Control Panel under Search Control > Query Mapping. When you open this tab, you will see all existing query mappings that you have already defined.
Please note: in addition to defining new mappings you may import a configuration file for Google Site Search promotions if this was the engine you used before.
If you want to start from scratch, click the "New Mapping" button to open the query mapping editor.
There are four steps to creating a new mapping.
- Under "Query" you have to define the search query to which the mapping should be applied. This can be any text or regular expression.
- Next, you the have to select the matching type. Your choices are as follows:
- Match: The visitor's search query has to be a perfect match for the mapping to apply. If you enter "fish" as the query in step 1 and select the type "match", then the mapping will only be triggered when the visitor's query contains the word "fish" and nothing else.
- Phrase: The mapping will be applied if the visitor types in several search terms and the entire mapped query is among these terms (part of the search phrase). Taking the same "fish" query example, "fish and chips" or "fresh fish" will bring up the results you specify for "fish" in this case.
- Contains: The mapping will be applied if the visitor's search query contains the mapped query. In this case the mapping will be triggered by all incoming queries that contain "fish", including "fishes", "fishermen", or even "selfish".
- Regular Expression: The query defined in point 1 should be a regular expression that will match the incoming queries. This could be something like
- you can learn more about regular expression here.
- If you want to include this query in your search suggestions switch this toggle to "YES". This allows you to provide custom autosuggestions to your visitors with predefined results, an extremely powerful way to customize your visitors' search experience.
- In step 4 you define what will happen with the search query you are mapping. There are three options available, which will be described in the following sections:
Order ResultsThe first tab lets you reorder the natural ranking of the search results - even by content group. You may also place custom "artificial" search results.
The above image shows you the different possibilities you have to reorder your results.
- Here you see the list of content groups available for the entered query. If you didn't define any content groups or no specific content group was matched, the standard content group "OTHER" is shown.
- The three horizontal bars allow you to move search results up and down in the result list, like so:
By dragging and dropping a search result you may choose a new position for it in the list of naturally ranked search results.
- You can remove a search result from the result list by clicking the small "x" in the top right corner of the search result.
- Clicking "pin results from here up" will lock the selected search result in place along with all the results above it. The results will be marked green and will stay in the exact position where you placed them.
Please note that dragging a result will also cause it (and the results above it) to be pinned. It is not possible to pin a search result in position 5 and leave the results in position 1-4 unpinned.
- You may restrict the search results to only the pinned results using the toggle in the top right. Setting the toggle to "ON" will remove all other results and show only the pinned results to the user.
- Use the "Add Custom Result" button to create a new search result yourself.
There is a predefined HTML template you may use for your custom result, but the HTML is completely up to you. You may also use the following snippet to place an image into the custom search result:
The custom search result may be dragged around like natural search results to be placed in a certain position. A custom result is always pinned.
<a href="http://example.com/page01.html">Title for custom result</a> <br> <a href="http://example.com/page01.html" class="ss360-result-link">http://example.com/page01.html</a> <div class="ss360-content-container"> <a href="http://example.com/page01.html"> <img src="http://example.com/img01.jpg"> </a> <p>Custom result text</p> </div>
Did you notice the "Suggestion HTML" input field? There you can enter text or even full HTML markup which will be shown in the autosuggestion for the custom result.
RewriteThe query mapping editor's "Rewrite" tab allows you to rewrite a query.
Rewriting a query means that when a visitor searches for a mapped query, the engine will search instead for the query you determined and show a different result set. For example, someone could search for "telephone" and you could rewrite this internally to "contact details" to show the results for contact details instead. The user will not see that a rewrite has occurred.
This feature is most often used when you see recurring search terms with no results. You may manually select a new query that will lead the users to the most relevant results.
Redirect to URLSometimes it is best to redirect a user directly to the page with the desired information when a certain search term is entered. To do this, use the "Redirect to URL" tab.
Simply enter the relevant URL into the input field and save the mapping - the user will be redirected instantly.
If you are using the SS360 API, please be aware that the resulting JSON looks different when a query is redirected.
If you have questions, please get in touch with us to help you by email or via Dev Chat.