lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ramzi Alqrainy <ramzi.alqra...@gmail.com>
Subject Re: SolrJ and Lucene queries
Date Tue, 21 Oct 2014 19:09:10 GMT
Use query() to have Solr search for results. You have to pass a SolrQuery
object that describes the query, and you will get back a QueryResponse (from
the org.apache.solr.client.solrj.response package).
SolrQuery has methods that make it easy to add parameters to choose a
request handler and send parameters to it. Here is a very simple example
that uses the default request handler and sets the q parameter:

<http://lucene.472066.n3.nabble.com/file/n4165239/1.png> 

To choose a different request handler, for example, just set the qt
parameter like this:

<http://lucene.472066.n3.nabble.com/file/n4165239/2.png> 

Once you have your SolrQuery set up, submit it with query():

<http://lucene.472066.n3.nabble.com/file/n4165239/3.png> 

The client makes a network connection and sends the query. Solr processes
the query, and the response is sent and parsed into a QueryResponse.
The QueryResponse is a collection of documents that satisfy the query
parameters. You can retrieve the documents directly with getResults() and
you can call other methods to find out information about highlighting or
facets.

<http://lucene.472066.n3.nabble.com/file/n4165239/4.png> 



--
View this message in context: http://lucene.472066.n3.nabble.com/SolrJ-and-Lucene-queries-tp4165233p4165239.html
Sent from the Solr - User mailing list archive at Nabble.com.

Mime
View raw message