Query q = NumericRangeQuery.newIntRange(...) or Query q = new 
TermRangeQuery(....)
(depending on your field type)

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de


> -----Original Message-----
> From: Sowmya V.B. [mailto:vbsow...@gmail.com]
> Sent: Wednesday, June 15, 2011 11:22 AM
> To: java-user@lucene.apache.org
> Subject: Re: Boosting a document at query time, based on a field value/range
> 
> Hi
> 
> I am not getting the replies to my inbox ...hence the delay in responding.
> 
> >>I think you misunderstand Eric's answer, as his suggestion does
> >>exactly
> what you ask for. Have you tried the "OR **field**:[20 TO 30]^10" method?
> 
> 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.
> 
> S.
> 
> On Fri, Jun 10, 2011 at 10:38 AM, Sowmya V.B. <vbsow...@gmail.com>
> wrote:
> 
> > Hi Erick
> >
> > Thanks for the response.
> >
> > I would want the documents with values within #20-30# be ranked above
> > the documents with some other values.
> > Well, since there might be a case where there are no documents in that
> > range, I would also prefer to have other documents listed too,
> > somewhere lower down the rankings.
> >
> > Also, I don't want to do a simple sort on the results what lucene
> > gives, with its own ranking function.
> > I am looking for a possibility of boosting a given document at
> > query-time, based on the values of a particular field : instead of
> > plainly sorting the normal lucene results based on this field.
> > Is that possible, without going in to the scoring function?
> >
> > Sowmya.
> >
> > *************
> > I take it from this that you want documents with values #outside#
> > 20-30 to still be found? In that case you can do something like add a
> > clause
> > like:
> >
> > OR *field*:[20 TO 30]^10
> >
> > or similar.
> >
> > Best
> > Erick
> >
> > On Thu, Jun 9, 2011 at 5:10 PM, Sowmya V.B. <vbsow...@gmail.com>
> wrote:
> >
> >> Hi All
> >>
> >> I have joined the group only today..and began working with lucene
> >> only recently.
> >>
> >> My problem: I want to boost the ranking of certain documents, based
> >> on the values of certain fields.
> >>
> >> For example, if the field has  a range of values from 0 to 100 and
> >> the user chooses something like 20 to 30, as an option, along with
> >> the query; I want the documents which satisfy that condition (The
> >> field value being between 20 and 30) to get a boost during ranking.
> >>
> >> Is there a way to do that in Lucene? I could not find an
> >> understandable explanation in the past mails about this. Hence, starting a
> fresh thread.
> >>
> >> Sowmya.
> >>
> >> --
> >> Sowmya V.B.
> >> ----------------------------------------------------
> >> Losing optimism is blasphemy!
> >> http://vbsowmya.wordpress.com
> >> ----------------------------------------------------
> >>
> >
> >
> >
> > --
> > Sowmya V.B.
> > ----------------------------------------------------
> > Losing optimism is blasphemy!
> > http://vbsowmya.wordpress.com
> > ----------------------------------------------------
> >
> 
> 
> 
> --
> Sowmya V.B.
> ----------------------------------------------------
> Losing optimism is blasphemy!
> http://vbsowmya.wordpress.com
> ----------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to