Re: Lucene query to Solr query

2020-06-01 Thread gnandre
Is this odd use-case where one needs to convert Lucene query to Solr query? Isn't this normal use-case when somebody is trying to port their Lucene code to Solr? I mean, is it like a XY problem where I should not even run into this problem in the first place? On Sun, May 31, 2020 at 9:40 AM Mikha

Re: Lucene query to Solr query

2020-05-31 Thread Mikhail Khludnev
There's nothing like this now. Presumably one might visit queries and generate Query DSL json, but it might be a challenging problem. On Sun, May 31, 2020 at 3:42 AM gnandre wrote: > I think this question here in this thread is similar to my question. > > https://lucene.472066.n3.nabble.com/Luce

Re: Lucene query to Solr query

2020-05-30 Thread gnandre
I think this question here in this thread is similar to my question. https://lucene.472066.n3.nabble.com/Lucene-Query-to-Solr-query-td493751.html As suggested in that thread, I do not want to use toString method for Lucene query to pass it to the q param in SolrQuery. I am looking for a function

Re: Lucene query to Solr query

2020-05-30 Thread Erick Erickson
edismas is quite different from straight Lucene. Try attaching &debug=query to the input and you’ll see the difference. Best, Erick > On May 30, 2020, at 12:32 AM, gnandre wrote: > > Hi, > > I have following query which works fine as a lucene query: > +(topics:132)^0.02607211 (topics:146)^0.0

Re: Lucene query to Solr query

2020-01-22 Thread Edward Ribeiro
equivalent to "+(topics:29)^2 (topics:38)^3 +(-id:41135)", I mean. :) Edward On Wed, Jan 22, 2020 at 1:51 PM Edward Ribeiro wrote: > Hi, > > A more or less equivalent query (using Solr's LuceneQParser) to > "topics:29^2 AND (-id:41135) topics:38^3" would be: > > topics:29^2 AND (-id:41135) topi

Re: Lucene query to Solr query

2020-01-22 Thread Edward Ribeiro
Hi, A more or less equivalent query (using Solr's LuceneQParser) to "topics:29^2 AND (-id:41135) topics:38^3" would be: topics:29^2 AND (-id:41135) topics:38^3 Edward On Mon, Jan 20, 2020 at 1:10 AM Arnold Bronley wrote: > Hi, > > I have a Lucene query as following (toString represenation of

Re: Lucene Query to Solr query

2009-05-28 Thread Erik Hatcher
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

Re: Lucene Query to Solr query

2009-05-28 Thread Avlesh Singh
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 toSt

Re: Lucene Query to Solr query

2009-05-28 Thread Reza Safari
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

Re: Lucene Query to Solr query

2009-05-26 Thread Reza Safari
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.c

Re: Lucene Query to Solr query

2009-05-25 Thread Yonik Seeley
On Mon, May 25, 2009 at 3:09 AM, Reza Safari 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 per

Re: Lucene Query to Solr query

2009-05-25 Thread Avlesh Singh
> > Also, most (none?) Query objects do not have a parseable toString > representation so it may not even work at all. > IMO, this behavior is limited to the Subclasses of SpanQuery. Anyways, I understand the general notion here. Cheers Avlesh On Mon, May 25, 2009 at 9:30 PM, Shalin Shekhar Mang

Re: Lucene Query to Solr query

2009-05-25 Thread Shalin Shekhar Mangar
On Mon, May 25, 2009 at 9:16 PM, Avlesh Singh wrote: > Point taken, Erik. But, is there really a downside towards using > Query.toString() if someone is not using any of the complex Query > Subclasses > (like a SpanQuery)? > Well, you will be relying on undocumented behavior that might change in

Re: Lucene Query to Solr query

2009-05-25 Thread Avlesh Singh
Point taken, Erik. But, is there really a downside towards using Query.toString() if someone is not using any of the complex Query Subclasses (like a SpanQuery)? Cheers Avlesh On Mon, May 25, 2009 at 5:38 PM, Erik Hatcher wrote: > Warning: toString on a Query object is *NOT* guaranteed to be par

Re: Lucene Query to Solr query

2009-05-25 Thread Erik Hatcher
Warning: toString on a Query object is *NOT* guaranteed to be parsable back into the same Query. Don't use Query.toString() in this manner. What you probably want to do is create your own QParserPlugin for Solr that creates the Query however you need from textual parameters from the client

Re: Lucene Query to Solr query

2009-05-25 Thread Avlesh Singh
You missed the point, Reza. toString *has to be implemented* by all Queryobjects in Lucene. All you have to do is to compose the right Lucene query matching your needs (all combinations of TermQueries, BooleanQueries, RangeQueries etc ..) and just do a luceneQuery.toString() when performing a Solr

Re: Lucene Query to Solr query

2009-05-25 Thread Reza Safari
Hmmm, overriding toString() can make wonders. I will try as you suggested. Thanx for quick reply. Gr, Reza On May 25, 2009, at 9:34 AM, Avlesh Singh wrote: If you use SolrJ client to perform searches, does this not work for you? SolrQuery solrQuery = new SolrQuery(); solrQuery.setQuery(*m

Re: Lucene Query to Solr query

2009-05-25 Thread Avlesh Singh
If you use SolrJ client to perform searches, does this not work for you? SolrQuery solrQuery = new SolrQuery(); solrQuery.setQuery(*myLuceneQuery.toString()*); QueryResponse response = mySolrServer.query(solrQuery); Cheers Avlesh On Mon, May 25, 2009 at 12:39 PM, Reza Safari wrote: > Hello, >