Op Friday 30 May 200812:10 schreef Claudio Corsi: > Hi all, > I'm querying my index with a SpanNearQuery built on top of some > SpanOrQuery. Now, the Spans object I get form the SpanNearQuery > instance returns me back the sequence of text spans, each defined by > their starting/ending positions. I'm wondering if there is a simple > way to get not only the start/end positions of the entire span, but > the single matching positions inside such span. For example, suppose > that a SpanNearQuery composed by 3 SpanTermQuery > (with a slop of K) produce as resulting span the terms sequence: <t0 > t1 t2 t3 .... t100> (so start() == 0, end() == 100). I know that for > sure t0 and t100 have generated a match, since the span is "minimal" > (right?).
Right. But make sure to test, some less than straightforward situations are possible when matching spans. For example, the subqueries may be SpanNearQuery's themselves instead of SpanTermQuery's. > But I also know that there is a 3th match somewhere in the > span (I have 3 SpanTermQuery that have to match). Is there a way to > discover it? To get this information, you'll have to extend NearSpansOrdered and NearSpansUnordered (package private classes in o.a.l.search.spans) to also provide for example an int[] with the actual matching 'positions', or subspans each with their own begin and end. This is fairly straightforward, but to actually use such positions SpanScorer will also need to be extended or even replaced. In case you want to continue this discussion, please do so on java-dev. Regards, Paul Elschot. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
