Yeah, it'd be nice if Query could be serialized across the wire and
could be deserialized in a new QParser on the Solr side. An
alternative to that is to use Lucene contrib's XML query parser.
Still a work in progress, but the basics are here: http://issues.apache.org/jira/browse/SOLR-839
Erik
On May 28, 2009, at 3:19 AM, Avlesh Singh wrote:
That was exactly my point, Reza. As long as the query objects being
used are
"simple", there is no harm in using toString. But Erik's waring is
valid as
well.
Putting it in SolrJ would not make sense as the behavior of toString
is not
consistent. Query objects like SpanQuery don't even have a toString
representation.
Having said that, IMO users of SolrJ can take a consious decision of
using
Lucene to compose their query and do a toString for using SolrJ.
Cheers
Avlesh
On Thu, May 28, 2009 at 12:35 PM, Reza Safari <r.saf...@lukkien.com>
wrote:
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.