lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Umesh Prasad <umesh.i...@gmail.com>
Subject Re: Lucene Ranking Problem
Date Tue, 18 Jan 2011 12:31:32 GMT
Hi Lahiru,
   Comments are inline:


On Tue, Jan 18, 2011 at 5:42 PM, Lahiru Samarakoon <lahiruts@gmail.com>wrote:

> Dear All,
>
>  I have two documents. The analyzed and the tokenized contents are
> mentioned
> below.
>
>  *Document 1 :*
>
>  *when*, null_1, *my*, null_1, money,
>
> fund, amount, payment, creditcard, credit,
>
> card, *bank, account*, debit, deduct,
>
> *charge*, null_1, my, mobile, usage,
>
> *service*, connection
>
>
>  *Document 2:*
>
>  *when*, what, time, what, day,
>
> null_1, money, fund, cash, payment,
>
> null_1, i, do, you, i,
>
> null_1, deduct, *charge*, reduce, debit,
>
> from, *my*, *bank, account*, credit,
>
> card, null_1, *adsl*, adsl1, adsl-2,
>
> adsl-1, adsl2, adsl, 1, adsl,
>
> 2, usage, connection, *service*
>
>
>  Then, I searched for the following text.
>
>  *Query:* when my bank account charge adsl service
>
>  *Scores
> *
>
> Document 1 = 0.74406385
>
> Document 2 = Score = 0.66067594
>
>     Please read the documentation of lucene scoring.
 http://lucene.apache.org/java/2_9_1/scoring.html.
That will help you understand the bigger picture.


>  I was expecting to have Document 2 as the top ranked document. But I get
> Document 1 as the top ranked even it does not contains  the term “adsl”.
>
>  The word order of the Document 1 matches with the query very well. Can it
> be the reason ?
>
> Word order doesn't matter. However tf/idf , norms and other factors do
matter as described in above link.

You can get see how , documents got assigned score by using

IndexSearcher.explain(query,docId); as described in
http://lucene.apache.org/java/2_9_1/api/core/org/apache/lucene/search/Searcher.html#explain%28org.apache.lucene.search.Query,%20int%29


If it is, how can I neglect the word order when searching. (I am not using
> phase queries).
>
> My searching code look like below and it is very simple.
>
>
>  *QueryParser parser = new QueryParser(Version.LUCENE_30, *
>
> *"pattern", *
>
> *new StandardAnalyzer(Version.LUCENE_30)); *
>
> *org.apache.lucene.search.Query query1 =
> parser.parse(this.query.getQuestion()); *
>
> *TopDocs hits = is.search(query1, 10); *
>
>  Please advice
>
>
> Thanks,
>
> Lahiru
>



-- 
---
Thanks & Regards
Umesh Prasad

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message