On 9/22/2013 7:43 AM, Baskar Sikkayan wrote:
> http://localhost:18080/solr/select?defType=dismax&pf=tagged_skills
> ^100&q=java+ejb+Spring&qf=tagged_skills&q.op=AND
> 
> I am not sure how to execute the same thing using Solr Java client.
> 
> SolrQuery query = new SolrQuery();
>         query.setQuery( "tagged_skills:\"java+and+ejb\"" );
>         QueryResponse rsp = server.query( query );
>         SolrDocumentList docs = rsp.getResults();
> 
> 
> Also not sure how to check if the given search is there in title and
> tageed_skills field.

The solrj code for a query that's completely identical to your HTTP
query is this:

SolrQuery qry = new SolrQuery();
qry.set("defType", "dismax");
qry.set("pf", "tagged_skills^100");
qry.set("qf", "tagged_skills");
qry.set("q.op", "AND");
qry.setQuery("java ejb Spring");

If you change pf to "tagged_skills^100 title^100" and qf to
"tagged_skills title" that should extend the search to the title field
as well.  Note that with q.op set to AND, the results may not be what
you expect.  I'm not sure whether dismax is smart enough to only apply
the AND within each of the field searches, I would expect it to apply it
across the board so all the query data must exist in all query fields.

Thanks,
Shawn

Reply via email to