lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven A Rowe <>
Subject RE: Increase number of available positions?
Date Mon, 15 Mar 2010 22:04:45 GMT
Hi Rene,

Have you seen SpanNotQuery?: 


For a document that looks like:

<Level_1 id="1">
  <Level_2 id="1">
    <Level_3 id="1">T1 T2 T3</Level_3>
    <Level_3 id="2">T4 T5 T6</Level_3>
    <Level_3 id="3">T7 T8 T9</Level_3>
  <Level_2 id="2">
    <Level_3 id="1">T10 T11 T12</Level_3>
    <Level_3 id="2">T13 T14 T15</Level_3>
    <Level_3 id="3">T16 T17 T18</Level_3>

You could generate the following token stream (L_X being a concrete level boundary token):

L_1 L_2 L_3 T1  T2  T3  L_3 T4  T5  T6  L_3 T7  T8  T9
    L_2 L_3 T10 T11 T12 L_3 T13 T14 T15 L_3 T16 T17 T18
    L_2 ...

A query to find T2 and T8 on the same Level_2 would require you to find a span containing
T2 and T8, but not containing L_2.

This scheme will generalize to as many levels as you need, and you can use nested span queries
to simultaneously provide constraints at multiple levels.  No position increment gap required.

Caveat: this scheme is not tested - I could be way off base :).


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

View raw message