Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging Search Keywords in Solr / Lucene

I'm new to Solr and am looking for a way to record searches (or keywords) to a log file or database so that I can then analyse for data visualisation.

  • Can Solr do this already?
  • Is this data accessible via. a Solr query?

Thanks.


Update 1

I'm starting to think I might need to write my own Solr analyzer?

like image 504
Ryall Avatar asked Jan 21 '10 11:01

Ryall


People also ask

How do I get solr logs?

To view the Apache Solr log: Sign on to the Solr pod. Go to /home/solr-anchor/solr/server/logs and view the file solr. log .

How do I search in solr?

The main query for a solr search is specified via the q parameter. Standard Solr query syntax is the default (registered as the “lucene” query parser). If this is new to you, please check out the Solr Tutorial. Adding debug=query to your request will allow you to see how Solr is parsing your query.

How does solr query work?

Solr works by gathering, storing and indexing documents from different sources and making them searchable in near real-time. It follows a 3-step process that involves indexing, querying, and finally, ranking the results – all in near real-time, even though it can work with huge volumes of data.

Where can the system logs for solr be found on Windows from the solr install directory?

There is solr. log file under /var/log/ folder. It records all the solr related logs.


1 Answers

I think it depends on what you are looking to log? Are you just looking to record the queries users are submitting as well as the results? If it's just "what are folks searching for" then you have that data in the q parameter that is logged by the servlet container. If you are using the default Jetty setup, look at ./logs/*request.log. You will see lines like:

0:0:0:0:0:0:0:1%0 -  -  [21/01/2010:15:08:29 +0000] "GET /solr/select/?q=*:*&qt=geo&lat=45&long=15&radius=10 HTTP/1.1" 200 197 

In this case, you can parse out that the user was doing a q=: search! Use a tool like AWStats to parse your logs and do the analysis. It's at least a quick and easy way to get some information!

like image 155
Eric Pugh Avatar answered Oct 04 '22 15:10

Eric Pugh