Site Search - Multiple rows in report with the same keyword


I am seeing repeated keywords in the Behavior → “Site Search” section. My assumption was that searches for the same keyword would roll up to one row and not be duplicated. Are there situations where the exact keyword would be repeated on multiple rows?

Some context:
My internal site search/filter has multiple query parameters that are logically combined for a single query.
The query parameters are non-standard and not setup to be recorded automatically as a search by Matomo.

To capture the complete search request, I have javascript code create a normalized, human readable search string and record this using the matomo JS api. Example search string:

“Audiences=administrative-staff|Creation Year Range=2000 2021”

Example call to Matomo JS:
// Search keyword
“Audiences=administrative-staff|Creation Year Range=2000 2021”,
// Search category selected in your search engine. If you do not need this, set to false
// Number of results or false for unknown.

If the result is paginated and the user goes to page 2, etc, I make the same _paq.push call again as that is how I understand the “Search Results Pages” column is populated.

Generally the search reporting is working as I would expect, except I am seeing some duplicate keyword rows, like this:

Audiences=administrative-staff|Creation Year Range=2000 2021 ~the rest of the data columns~
Audiences=administrative-staff|Creation Year Range=2000 2021 ~the rest of the data columns~

Note: Not all rows have duplicate keywords. Some do appear to be rolling up and I cannot figure out the circumstances to cause the duplicate rows. Sometimes the other columns (searches, search results pages, search exits) have different values across duplicate keyword rows. But sometimes they do not.

Any help, or suggestion on how to debug would be great. Possibly looking at the search query Matomo uses to build this report would be a help. Clearly the row key is not just the keyword column. Thanks!

Matomo 4.5.0, Debian 10

Hello! No suggestions on the thread yet, so I thought I’d try a few quick questions.

  • Should site search keywords only appear one time in reporting or are there situations when the same keyword will be listed on multiple rows?
  • Can someone provide me (or point me to) the SQL that is generating the basic site search report? I’ve looked at the PHP, but am having trouble figuring this out. Essentially I’m trying to understand how the keywords are extracted from the raw data to see if there’s a clue as to why I’m seeing duplicate keywords in the reporting.

Thanks for the help!

The database schema is there:

Also an interesting query:

especially in paragraph: ** SQL query to select the list of all site searches**