lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <>
Subject Re: "Advanced" query language
Date Mon, 05 Dec 2005 20:18:04 GMT
On Monday 05 December 2005 17:56, John Haxby wrote:
> Yonik Seeley wrote:
> >I looked into this a year ago... most scripting languages have an
> >emphasis on script execution speed, not script parsing speed (which is
> >what we would need).  The scripting languages I tried were horribly
> >slow at parsing a small script.  The only one that could parse at a
> >reasonable speed was rhino (javascript) in interp mode.
> >  
> >
> I've always found the lisp syntax very easy to parse.  In this case, 
> it's just prefix with the nam of he operator being first in the list, eg 
> (and "eggs" "oranges").   There are wrinkles for named and optional 
> parameters, but the basic syntax is a doddle.

Lisp syntax is good at nesting, and it also does properties and roles:

((phrase 5) "eggs" "oranges")

(boolean (must "eggs") (mustnot "oranges"))

I like the simplicity. Now the earlier example:

    ((moreLikeThis (percent "0.25") (docId "44")) 
      (compareField "contents")
      (compareField "title")
  ((downgrade (demote "0.5"))
    ((simple "contents")
      (or "ice hockey" puck rink)

The deep nesting is tricky with only one kind of
partentheses/brackets. Perhaps python like is better. Python
has nesting by indentation introduced by a colon at the end
of the previous line.
To be read with a fixed width font:

    moreLikeThis(percent="0.25", docId="44"): 
        "ice hockey"

Quite readable, but not so easy to parse.
(One could even do away with the colons.)

Paul Elschot

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

View raw message