lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ahmet Arslan <iori...@yahoo.com>
Subject Re: Example of DisMax query with embeded Solr (using SolrJ)
Date Tue, 18 Jan 2011 15:57:36 GMT
> Is there an example of how to use dismax with embedded
> Solr?I am currently
> creating my query like this:
>         QueryParser parser = new
> QueryParser(Version.LUCENE_CURRENT,"content", new
> StandardAnalyzer(Version.LUCENE_CURRENT));
>         Query q = parser.parse(query);
>         searcher.search(q, end);
> 
> How would this look with DisMax query?
> Any help would be appreciated.

Every valid solr search URL can be converted into SolrQuery. Some of the parameters have special
named methods, some does not.

If you have a separate handler that uses dismax as a defType you can use simply: 

SolrQuery q = new SolrQuery();
q.setQueryType("dismax"); // this roughly equivalent of q.set("qt", "dismax")

It does not have a special method to set query parser but you can use q.set("defType","dismax")
instead.

You can think SolrQuery as a something that holds key-value pairs.


      

Mime
View raw message