Logging which client connected to Solr

2014-03-27 Thread Juha Haaga
Hello,

I’m investigating the possibility of logging the username of the client who did 
the search on Solr along with the normal logging information. The username is 
in the basic auth headers of the request, and the access control is managed by 
an Apache instance proxying to Solr. Is there a way to append that information 
to the Solr query log, so that the log would look like this:

INFO  - 2014-03-27 11:16:24.000; org.apache.solr.core.SolrCore; [generic] 
webapp=/solr path=/select params={lots of params} hits=0 status=0 QTime=49 
username=juha

I need to log both username and the query, and if I do it directly in Apache 
then I lose the information about amount of hits and the query time. If I log 
it with Solr then I get query time and hits, but no username. Username logging 
is higher priority requirement than the hits and query time, but I’m looking 
for solution that covers both cases. 

Has anyone implemented this kind of logging scheme, and how would I accomplish 
this? I couldn’t find this as a configuration option.

Regards,
Juha







Steps for creating a custom query parser and search component

2013-06-20 Thread Juha Haaga
Hello list followers,

I need to write a custom Solr query parser and a search component. The 
requirements for the component are that the raw query that may need to be split 
into separate Solr queries is in a proprietary format encoded in JSON, and the 
output is also going to be in a similar proprietary JSON format. I would like 
some advice on how to get started.

Which base classes should I start to work with? I have been looking at the 
plugin classes and my initial thoughts are along the lines of following 
workflow:

1. Subclass (QParser?) and write a new parser method that knows how to deal 
with the input format.
2. Subclass (SolrQueryRequestBase?) or use LocalSolrQueryRequest like in the 
TestHarness.makeRequest() and use it to execute the required queries.
3. Compile the aggregate results as specified in the query. 
4. Use some existing component (?) for returning the results to the user.
5. Put these components in steps 1-4 together into (?) so that it can be added 
to solrconfig.xml as a custom query parser accessible at 
http://solr/core/customparser

Is my approach reasonable, or am I overlooking some canonical way of achieving 
what I need to do? What and where do I need to look into to replace the 
question marks in my plan with knowledge? :)

-- Juha