They all give exactly the same score, even the 3rd doc which doesn't contain abcd at all? Surprising. What does searcher.explain() say? Is this a simple search with default Similarity or is there stuff you're not telling us?
-- Ian. On Sat, Jan 28, 2012 at 4:44 AM, A Z <4azfri...@gmail.com> wrote: > Hi lan > > thanks for your reply. > > when i boosting each term while searching like abcd is boost with boost > factor of 10 and pqrst boost with boost factor of 5. > then also it gives same score for documents > > *Query content:abcd^10.0 content:pqrst^5.0* > > > title ->pqrst uvwx abcd ::: content -> pqrst uvwx abcd::: Score ->0.40883923 > > title ->abcd pqrst uvwx ::: content -> abcd pqrst uvwx::: Score ->0.40883923 > > title ->pqrst uvwx lmn ::: content -> pqrst uvwx lmn::: Score ->0.40883923 > > title ->pqrst uvwx lmn abcd ::: content -> pqrst uvwx lmn abcd::: Score > ->0.40883923 > > title ->pqrst abcd uvwx lmn ::: content -> pqrst abcd uvwx lmn::: Score > ->0.40883923 > Thanks > > On Wed, Jan 25, 2012 at 8:38 PM, Ian Lea <ian....@gmail.com> wrote: > >> If you want particular search terms to be more important than others >> you can use boosting. See >> http://lucene.apache.org/java/3_5_0/queryparsersyntax.html#Boosting a >> Term >> >> If you want the order of matched terms to matter, see PhraseQuery or >> SpanQuery. The latter is more flexible. See >> http://www.lucidimagination.com/blog/2009/07/18/the-spanquery/ for a >> good writeup. >> >> And you can of course use combinations of everything. >> >> >> -- >> Ian. >> >> >> >> On Tue, Jan 24, 2012 at 5:08 PM, A Z <4azfri...@gmail.com> wrote: >> > Hi >> > >> > >> > >> > how can we assign custom score for each token/word. >> > >> > >> > >> > For Ex >> > >> > I have document >> > >> > >> > >> > 1 pqrst uvwx abcd >> > >> > 2 abcd pqrst uvwx >> > >> > 3 pqrst uvwx lmn >> > >> > 4 pqrst uvwx lmn abcd >> > >> > 5 pqrst abcd uvwx lmn >> > >> > >> > >> > *Now i m searching data ---> abcd pqrst* >> > >> > So it should give more weightage score to 2nd document then 1st document >> > >> > >> > >> > So i want is >> > >> > *document 1 :---* *pqrst *has more *weight * then *uvwx *word and >> *then >> > abcd *word >> > >> > *document 2* *:---* *abcd *has more *weight * then *pqrst* word >> > and *then uvwx >> > *word >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >> For additional commands, e-mail: java-user-h...@lucene.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org