Tommaso,
Ah, now I see. If you want to add new operators, you'll have to modify the
javacc files. For the SpanQueryParser, I added a handful of new operators and
chose to go with regexes instead of javacc...not sure that was the right
decision, but given my lack of knowledge of javacc, it was expedient. If you
have time or already know javacc, it shouldn't be difficult.
As for nobrainer on the Solr side, y, it shouldn't be a problem. However, as
of now the basic queryparser is a copy and paste job between Lucene and Solr,
so you'll just have to redo your code in Solr....unless you do something
smarter.
If you'd be willing to wait for LUCENE-5205 to be brought into Lucene, I'd
consider adding this functionality into the SpanQueryParser as a later step.
Cheers,
Tim
From: Tommaso Teofili [mailto:[email protected]]
Sent: Friday, March 07, 2014 3:17 AM
To: [email protected]
Subject: Re: Suggestions about writing / extending QueryParsers
Thanks Tim and Upayavira for your replies.
I still need to decide what the final syntax could be, however generally
speaking the ideal would be that I am able to extend the current Lucene syntax
with a new expression which will trigger the creation of a more like this query
with something like +title:foo +"text for similar docs"%2 where the phrase
between quotes will generate a MoreLikeThisQuery on that text if it's followed
by the % character (and the number 2 may control the MLT configuration, e.g.
min document freq == min term freq = 2), similarly to what it's done for
proximity search (not sure about using %, it's just a syntax example).
I guess then I'd need to extend the classic query parser, as per Tim's
suggestions and I'd assume that if this goes into the classic qp it should be a
no brainer on the Solr side.
Does it sound correct / feasible?
Regards,
Tommaso
2014-03-06 15:08 GMT+01:00 Upayavira
<[email protected]<mailto:[email protected]>>:
Tommaso,
Do say more about what you're thinking of. I'm currently getting my dev
environment up to look into enhancing the MoreLikeThisHandler to be able handle
function query boosts. This should be eminently possible from my initial
research. However, if you're thinking of something more powerful, perhaps we
can work together.
Upayavira
On Thu, Mar 6, 2014, at 11:23 AM, Tommaso Teofili wrote:
Hi all,
I'm thinking about writing/extending a QueryParser for MLT queries; I've never
really looked into that code too much, while I'm doing that now, I'm wondering
if anyone has suggestions on how to start with such a topic.
Should I write a new grammar for that ? Or can I just extend an existing
grammar / class?
Thanks in advance,
Tommaso