White Hex icon
Introducing: A search & relevancy assessment from engineers, not theorists. Learn more

Nov 18, 2020

Listening to your users

Dru Sellers

Search Practices

5

min read

Does your application have a search bar? Are you recording what your users are searching for? If not, you are missing out on your customers literally telling you what they want from you. Paying attention to these asks can help guide you to customer delight.

If not, you are missing out on one of the strongest signals that your customer can send. By paying attention to what they are asking you for you can give them exactly what they want.

For the rest of the blog post I’ll be referencing this code snippet from a Ruby on Rails project. You could just as easily write this same snippet of code in your favorite language and framework, it’s not all that technical or interesting. Its the data that we end up capturing that is the star of this story.


<pre><code>


class ProductSearchController < ApplicationController   # other actions elided...   def post     query = params['q']     offset = params[:page] * params[:per_page]      # Perform the search     @products = Product.search(       query,       limit: params[:per_page],       offset: offset     )      # Record the search     SearchLog.create(       user: @current_user,       session: session.id,       query: query,       doc_ids: @products.map(&:id),     )   end end

</code></pre>

In the code snippet above, I’m demonstrating a chunk of code that is executing a search on behalf of the user. After the search is executed, we record a log of that search including the current session, the user executing the query, the raw query from the user, the docs that were returned, and what page was the user on.Help Customers WinThis simple set of data is enough for us to start hearing a story that our users are trying to tell us. Let’s look at an example user’s logs from a recent visit.

<pre><code>

user   | session_id | query      | doc_ids -------+------------+------------+--------------- user:1 | 20265a...  | windshield | [] user:1 | 20265a...  | fairing    | [34, 55, 768]

</code></pre>

Even with this small contrived example, we can see something that is interesting. user:1$1’s first search for windshield returned zero hits. Frustrated, the user went back to the search bar and tried the correct term fairing (the motorcycle term for a windshield). Now that they are using the correct term, they are able to start shopping which hopefully leads to them checking out.

Using this information, we could go back to our search index and add an alias from windshield to fairing, which would let users succeed with one less step. Once deployed, if a user searches for windshield, they will get the same results as a customer who typed in fairing.

<pre><code>

user   | session_id | query      | doc_ids -------+------------+------------+--------------- user:5 | 4b3ad5...  | windshield | [34, 55, 768]

</code></pre>

Bonsai recently released a plugin called elasticsearch-stored-synonyms that will let you store your synonyms in the Elasticsearch cluster but importantly allows hot reloading of synonyms without having to recreate the index.For more details check out: omc/elasticsearch-stored-synonyms

Giving your customers what they are asking for

Using this same set of data points let’s imagine a different scenario.

<code><pre>

user    | session_id | query                 | doc_ids --------+------------+-----------------------+-------- user:29 | 67f4ab...  | thing you don't carry | [] user:43 | 0b959c...  | thing you don't carry | [] user:54 | b96969...  | thing you don't carry | [] user:76 | 54e233...  | thing you don't carry | [] user:98 | 3d3483...  | thing you don't carry | [] user:34 | bfc08f...  | thing you don't carry | []

</code></pre>

In this dataset we can see six different users that are all looking for the same item, but it’s not one that you currently carry. If this started to show up “out of the blue,” then that might give us pause to reflect. Is this something that we want or should carry? If it meets the right criteria, you have just found another product that you can offer to your users. Pretty soon, that same dataset might start looking like:

<code><pre>

user    | session_id | query               | doc_ids --------+------------+---------------------+---------- user:29 | 67f4ab...  | thing you now carry | [98, 102] user:43 | 0b959c...  | thing you now carry | [98, 102] user:54 | b96969...  | thing you now carry | [98, 102] user:76 | 54e233...  | thing you now carry | [98, 102] user:98 | 3d3483...  | thing you now carry | [98, 102] user:34 | bfc08f...  | thing you now carry | [98, 102]

</code></pre>

If that then tracks to conversions, then we’ve identified a new stream of revenue simply by listening to what our customers are telling us.

Closing

We’ve only scratched the surface of what we can learn from our customers by listening to what they are telling us in the search bar. Hopefully, you can appreciate the insights that can be gathered from your search infrastructure.

Want to improve your search analytics? Schedule a call now with Bonsai.

Find out how we can help you.

Schedule a free consultation to see how we can create a customized plan to meet your search needs.