lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <>
Subject Re: "Advanced" query language
Date Sun, 04 Dec 2005 16:59:28 GMT

On Dec 4, 2005, at 11:02 AM, Paul Elschot wrote:
> Are there XML editors that can limit their output to a given  
> stylesheet?
> In that case one only needs to predefine a style sheet for queries.

Yes, there are many sophisticated XML editors.  I'm not quite sure  
where you're going with this though.

>> Almost all users want to enter "words separated by spaces", and very
>> little else.  QueryParser succeeds fine for this purpose.
> Those are not the users that I'm thinking of.

Those are some highly specialized users :)

>> I think we should focus on the machine-to-machine use case of
>> communicating a Query in this discussion.
> That's ok, but when a few simple constraints are enough to
> make it useful for humans that need the extra query power
> enough to be willing to enter more syntax, then why not?

I agree with the sentiment, truly.  And I'm quite open to QueryParser  
itself being expanded to support more sophisticated queries if the  
additional syntax still allows the more common simpler TermQuery/ 
PhraseQuery/BooleanQuery cases.

I just don't think its very practical to come up with such syntax and  
have any kind of consensus on it across the majority of Lucene  
users.  QueryParser is surely embedded in many applications and  
exposing querying capability that the application developers may not  
be aware is possible.  Field selection itself is even questionable in  
the general sense.

In short, QueryParser is a double-edged sword - powerful, but perhaps  
too powerful.  Simple in one sense, but too complicated when digging  
deeper.  I could almost be bold enough to claim that each application  
should build this kind of parsing in a custom way.

>>> I don't know XML that well. Does it have a facility to allow
>>> different roles
>>> for nested constructs?
>> I'm not following what you mean by different roles.  Could you
>> provide an example.
> For example the clauses in a boolean query can have these roles:
> required, optional, and excluded.
> Thinking about it, this would probably map to sth like:
> <BooleanQuery>
>   <BooleanClause role="required">
>     <SomeSubQuery/>
>   </BooleanClause>
>   <!-- more clauses -->
> </BooleanQuery>
> Is it possible in XML to predefine rc so that <rc>...</rc> means:
> <BooleanClause role="required">...</BooleanClause> ?

Only via DTD/XSD could this be done, but that is way overkill and too  
complicated for our purposes.  For the general XML case, make it  
verbose specifying everything with no shortcuts like this.  The flags  
should be spelled out explicitly for <BooleanClause>.  If someone  
wants a shortcut XML syntax, that is where XSLT could come in, possibly.

"role" seems too generic here.  I recommend something like  
occur="must/should/mustnot" which maps to the API more precisely.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message