lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: Can Span Queries contain boolean, prefix and other component queries?
Date Mon, 05 Sep 2005 02:38:20 GMT

: >>[Query]
: >>"Napol* Dynamite" near "film|movie"

: >This can be done using nested SpanNearQuery's and SpanOrQuery's.
: >A PhrasePrefixQuery can not be used as a SpanQuery.

I've never really looked at SpanQueries very hard, but this thread got me
a bit curious.

Looking over the docs and the code, it seems that *IF* there were a
"SpanPrefixQuery" then the query could be expressed as...

  new SpanNearQuery(new SPanQuery[] {
      new SpanNearQuery((new SpanQuery[] {
         new SpanPrefixQuery(new Term(f, "Napol")),
         new SpanTermQuery(new Term(f,"Dynamite"))
        0, true
      new SpanOrQuery(new SPanQuery[] {
         new SpanTermQuery(new Term(f,"film")),
         new SpanTermQUery(new Term(f,"movie))
    MAX_INT, false

The question then becomes, can a SpanPrefixQuery exist?

looking at the code for SpanTermQuery, it seems like it should be possible
to write a subclass which redefines the getSPans() method to return a Span
which not only maintains a TermPosition, but also a TermEnum which
iterates over all terms which match the prefix -- the TermPositions
iterator loop would be reset as many times as the TermEnum found
usable terms.

Am I missing something about the way Spans work? ... Is what I'm
suggesting possile/practicle, or is there a reason it doesn't allready


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

View raw message