I am using Lucene version 3.0.0. I am already setting boost to field but still result are not according to requirement i.e. Document that have all the matching term either in title or body field must be on top. Regardless of term frequency & idf.
1. I have 2 fields in document i.e. Title & body 2. Query is: +(title: lazy^3 or dog^3 or fox^3) +(body:lazy^2 or dog^2 or fox^2). 3. Document that have all three terms in *Title* must be on top and then all terms in titte or body and so on I have overwrite default similarity as below but it does not work. LoadSimilarity extends DefaultSimilarity { private static final long serialVersionUID = -909003452363957475L; @Override public float coord(int overlap, int maxOverlap) { return 1.0F; } On Thu, Apr 30, 2015 at 6:17 PM, Allison, Timothy B. <talli...@mitre.org> wrote: > Depending on your version of Lucene, perhaps: > > http://lucene.apache.org/core/4_10_4/core/org/apache/lucene/document/Field.html#setBoost(float) > > -----Original Message----- > From: Muhammad Ismail [mailto:it.is.ism...@gmail.com] > Sent: Thursday, April 30, 2015 3:22 AM > To: java-user@lucene.apache.org > Subject: Re: Lucene Field Boost > > Any one ? > > On Thu, Apr 30, 2015 at 12:01 AM, Muhammad Ismail <it.is.ism...@gmail.com> > wrote: > > > Hi > > > > I have simple index with 2 fields i.e. title and body. When i perform a > > simple search query like bring document which have particular text like > > lazy or dog or brown in either title or body but I want matches in title > > get boost over body reault. Also document which have all matches must be > on > > top. should i need to overwrite lucene similarity > > > > > > -- > Thanks > Muhammad Ismail > cell (PAK) : +92.322.5100362 > cell (Sweden): +46 700-321-521 > e-mail: it.is.ism...@gmail.com > > This message may contain confidential and/or privileged information. If > you are not the addressee or authorized to receive this for the addressee, > you must not use, copy, disclose or take any action based on this message > or any information herein. If you have received this message in error, > please advise the sender immediately by reply e-mail and delete this > message. Thank you for your cooperation. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > -- Thanks Muhammad Ismail cell (PAK) : +92.322.5100362 cell (Sweden): +46 700-321-521 e-mail: it.is.ism...@gmail.com This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.