Capturing search keywords when no request parameters is shown in the url

hello,
How can you capture keywords on applications where search is launched with javascript and the results are displayed in the current url (through ajax response I suppose). In the present case, the application is using a lunr.js library as indexing and searching library.

You can manually trigger a site search query: https://developer.matomo.org/guides/tracking-javascript-guide#internal-search-tracking

Thanks for your answer. I had already seen it but what I understand (maybe I’m wrong) is that we can capture only predefined keywords but what about if you want to get all used keywords systematically ?

You have to track every site search on your page as it happens. Then, you can see all search queries in the Matomo reporting.

Sorry but that’s precisely what I don’t understand in the trackSiteSearch method.
According to the example :

_paq.push(['trackSiteSearch',
   // Search keyword searched for
   "Banana",
   // Search category selected in your search engine. If you do not need this, set to false
   "Organic Food",

I have to specify what specific keywords I want Matomo to check for.
What I would like to do is getting every used keyword knowing that they cannot be harvested from the url by the default mecanism.

Right, but in your CMS / Website, there must be another mechanism to retrieve this search keyword, even if it is a document.getElementById('#searchForm').value; - after retrieving that search phrase, you have to put it into the mentioned method to tell Matomo which keyword a visitor has been searching for.

Oh yes ! got it thanks