lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sirish Vadala <>
Subject RE: Issue with sentence specific search
Date Wed, 06 Oct 2010 19:19:04 GMT

Hmmm... My mistake.

In fact it is not a phrase search, but its a proximity search.

My screen gives four options to the user: -All words, -Exact phrase, -At
least one word, -Within proximity of xx words.

In case of -All words and -At least one word, this is irrelevant an
everything works fine.

In case of -Exact phrase, I do need to make it sentence specific that works
well with my current implementation.

In case of -Within proximity of xx words, the user wants to have an option,
to either check within xx words in the same sentence or without any sentence

I am using the following code to perform proximity search:

QueryParser qParser = new QueryParser(Version.LUCENE_29, field,
query = qParser.parse(strQuery);

//strQuery format --> "Search Text"~SPAN

bQuery.add(query, BooleanClause.Occur.MUST);

this.analyzer is my custom analyzer. This is to implement, as I already
said, right now I am adding each sentence as a separate field(with the same
field name) to the same document. Also I am setting the  position increment
gap that I did by sub-classing Analyzer and overriding
Analyzer#getPositionIncrementGap() to return 10.

Since for each sentence, the position increment gap is modified, I am not
sure if I can perform a sentence independent proximity search. 

Apologize for not putting it well before and appreciate any responses.
View this message in context:
Sent from the Lucene - Java Users mailing list archive at

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

View raw message