I found out that toString() works well as long as you use string values and do not use Lucene utility classes like NumberTools.longToString(someLongValue)
Maybe nice future to have a Lucene query wrapper in solr package!

Reza

On May 26, 2009, at 2:18 PM, Reza Safari wrote:

That is not what I'm looking for because my Lucene query is very complicated and contains many Query sub classes.

org.apache.lucene.search.Query luceneQuery = buildLuceneQuery(); // contains many types BooleanQuery, TermQuery etc SolrServer server = new CommonsHttpSolrServer("http://example.com/ solr");
server.query(luceneQuery)  // doesn't compile
SolrQuery solrQuery = new SolrQuery(luceneQuery.toString()); // doesn't work because toString() results to something like this: +(stage:0000000000li84 stage:0000000000li74 stage:0000000000li76 stage:0000000009j1b7) -available_fields_field:*|DEACTIVATION_DATE|* + (content_authorization_group:000000000025t4)

Gr, Reza


On May 26, 2009, at 12:46 AM, Yonik Seeley wrote:

On Mon, May 25, 2009 at 3:09 AM, Reza Safari <r.saf...@lukkien.com> wrote:
One little question: is there any utility that can convert core Lucene query (any type e.q. TermQuery etc) to solr query? It's is really a lot of work
for me to rewrite existing code.

Solr internal APIs take Lucene query types.
I guess perhaps you mean transforming a Lucene query into a parameter
for the external HTTP API?

new TermQuery(new Term("foo","bar"))
 would be transformed to
q=foo:bar

-Yonik
http://www.lucidimagination.com


--
Reza Safari
LUKKIEN
Copernicuslaan 15
6716 BM Ede

The Netherlands
---------------------------------------------
http://www.lukkien.com
t: +31 (0) 318 698000

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
















--
Reza Safari
LUKKIEN
Copernicuslaan 15
6716 BM Ede

The Netherlands
---------------------------------------------
http://www.lukkien.com
t: +31 (0) 318 698000

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.














Reply via email to