On Wed, 2011-06-15 at 11:22 +0200, Sowmya V.B. wrote: > [...] "OR **field**:[20 TO 30]^10" > > Well, my question is partly answered with this clarification. But, I am > still wondering how to do that programmatically. > the (20-30) range is not a fixed range. Its chosen by the user. It can as > well be (12-34) too. I am not able to figure out if there is any function in > the searcher classs, which will enable me give these specifications > ...something like... a setboost(), which exists during index time.
The boost is something you do with your query, before it is issued to the searcher. If you use the query parser, you can provide the additional query parameters by concatenating them to the standard user query: String fullQuery = userQuery + " OR myrange:[" + from + " TO " + to + "30]^" + myBoost; If you build your Query by code, you can use ConstantScoreRangeQuery or RangeQuery for the range part, where you can call setBoost(float). - Toke Eskildsen --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org