Reference guide for the Search Logs page

: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.

:person_raising_hand: Required user level: Staff

The Search Logs page shows data for all searches made on a site. You can access this via the Admin > Logs > Search Logs tab (example.discourse.com/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

Last edited by @hugh 2024-07-23T12:02:53Z

Last checked by @hugh 2024-07-23T12:03:00Z

Check documentPerform check on document:
4 Likes