Reference guide for the Search Logs page

Looking for information about the Search Logs Page? You’re in the right place!

:bookmark: This is a reference guide for describing how the Search Logs page functions and the types of data you can search for on this page.

Search Logs Page

As of Discourse v1.9 you can lookup the Search Logs for all searches made on a site via the “Admin” → “Logs” → “Search Logs” tab (.../admin/logs/search_logs).

Data Points

The search logs page contains the following data points:

  • term: the text being searched.
  • searches: number of times the term has been searched for.
  • CTR: The click through rate of the term being searched. The CTR is equal to the number of clicks a search term has received divided by the number of total searches for the term. A high CTR is a good indication that users and finding the content they’re searching for on a site. Source code for the CTR rate is available here: discourse/app/models/search_log.rb.

Filters

The Search Logs page will only display the top 100 results regardless of any filters.

The search logs page can be filtered by the following:

  • Date: The date that a term was searched for. Selectable options include:
    • All Time
    • Year
    • Quarter
    • Month
    • Week
    • Day
  • Search Type: The type of search being made. These filters allow you to isolate terms that seem to get click throughs on one type of search that don’t on the other. Selectable options include:
    • Header: Searches made from the search ( :mag: ) icon on the top of every page.
    • Fullbody: Searches that are made from the the advanced search page available at (.../search)
      image

Additional Search Log Data

If you need information about search queries that you can’t get from the admin search logs page, you could try using the Data Explorer plugin. For example, here’s a Data Explorer query that returns search terms for a given username.

-- [params]
-- string :username

SELECT
sl.term,
COUNT(sl.term) AS query_count
FROM search_logs sl
JOIN users u
ON u.id = sl.user_id
WHERE u.username = :username
GROUP BY sl.term
ORDER BY query_count DESC
3 Likes