damd
damd

Reputation: 6957

Solr: Retrieving the query from a QueryResponse

Given a QueryResponse object (SolrJ 3.6.2), is there any way to retrieve the query that was made to get that response other than parsing the query string?

Upvotes: 0

Views: 594

Answers (2)

Prasad
Prasad

Reputation: 61

QueryResponse exposes the Header information from which the q can be retrieved. But it cant be directly retrived directly as mentioned by Jayendra.

You need to use:

response.getHeader().get("params");

This will give you a result like:

{start=0,q=apple,qf=name^10.0 description^5.0,version=2,rows=10,defType=edismax}

There you can see your result.

Upvotes: 1

Jayendra
Jayendra

Reputation: 52779

QueryResponse exposes the Header information from which the q can be retrieved.

rsp.getHeader().get("q")

Upvotes: 1

Related Questions