Seriously, why bother. I mean, just make an assumption about average sentence 
length, say 15, multiple by 3, and search for matches within that many words, 
say 50. Is there a great reason why that is not good enough?

-- Jack Krupansky

From: Mike Ree 
Sent: Friday, January 04, 2013 1:50 PM
To: [email protected] 
Subject: Search books specifying proximity of terms within n sentences

Hi everyone, new to the mailing list and figured this question to be more 
appropriate for dev than general. Hope I'm right. I sent this earlier but cc'ed 
someone and afraid it might not have been distributed correctly. So I'm sorry 
if this is a duplicate.

Question:
I have an index of books, and I want to allow the user the ability to find 
terms that are in nearby sentences.

IE:
"TermA NEAR3 TermB" would find all TermA's that are within 3 sentences of TermB.

Have found ways to find TermA within same sentence as TermB using SpanNotQuery 
and SpanNearQuery and adding sentence boundaries to the index, but I'm not able 
to find a way to extend this idea out to allow it to cross a limited number of 
sentence boundaries.

Only thing I can think of is to use a dynamic field per a sentence and a new 
type of query to be able to search across them, but before I do anything I was 
hoping to get some feedback.

Thanks,
Mike Ree

Reply via email to