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
abble.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 that accepts org.apache.lucene.search.Query and
> returns org.apac
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
607211 (topics:146)^0.008187325
> -asset_id:doc:en:index.html
>
> But, it does not work if I use it as a solr query with lucene as defType.
>
> For it to work, I need to convert it like following:
> q=+((topics:132)^0.02607211 (topics:146)^0.008187325
> +(-(asset_id:doc\:en\:index.html
Hi,
I have following query which works fine as a lucene query:
+(topics:132)^0.02607211 (topics:146)^0.008187325
-asset_id:doc:en:index.html
But, it does not work if I use it as a solr query with lucene as defType.
For it to work, I need to convert it like following:
q=+((topics:132)^0.02607211
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)
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
Hi,
I have a Lucene query as following (toString represenation of Lucene's
Query object):
+(topics:29)^2 (topics:38)^3 +(-id:41135)
It works fine when I am using it as a lucene query in
SolrIndexSearcher.getDocList function.
However, now I want to use it as a Solr query and query against a
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
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
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
Hello,
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.
Thanks,
Reza
--
Reza Safari
LUKKIEN
Copernicuslaan 15
6716 BM Ede
The Netherlands
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
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();
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
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
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 e...@ehatchersolutions.comwrote:
Warning: toString on a Query object is
On Mon, May 25, 2009 at 9:16 PM, Avlesh Singh avl...@gmail.com 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
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 Mangar
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
20 matches
Mail list logo