FAQ
Hi,

I am new to lucene ... I have a question while implementing similarity search using MoreLikeThis query. I have written a small program but it is not giving any results. In my index file I have both strored and unstored(analyzed) fields.

Sample Code :

IndexReader ir = IndexReader.open(index directory path);
IndexSearcher indexsearcher = new ProfileIndexSearcher(ir);
IndexSearcher indexsearcher = new IndexSearcher(ir);
MoreLikeThis mlt = new MoreLikeThis(ir);
Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30);
mlt.setAnalyzer(analyzer);
mlt.setFieldNames(string_of_fields);

Query query1 = mlt.like(1); // mlt.like(docnumber)
TopDocs matches = null;
matches = indexsearcher.search(query1,20);

As per my understanding I should atleast one document as result.

Is any one has idea what I can do to implement this serach.
Thanks in Advance.

--Madhu.

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

Search Discussions

  • Koji Sekiguchi at Mar 19, 2011 at 12:49 am

    (11/03/19 6:16), madhuri_1820@yahoo.com wrote:
    Hi,

    I am new to lucene ... I have a question while implementing similarity search using MoreLikeThis query. I have written a small program but it is not giving any results. In my index file I have both strored and unstored(analyzed) fields.

    Sample Code :

    IndexReader ir = IndexReader.open(index directory path);
    IndexSearcher indexsearcher = new ProfileIndexSearcher(ir);
    IndexSearcher indexsearcher = new IndexSearcher(ir);
    MoreLikeThis mlt = new MoreLikeThis(ir);
    Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30);
    mlt.setAnalyzer(analyzer);
    mlt.setFieldNames(string_of_fields);

    Query query1 = mlt.like(1); // mlt.like(docnumber)
    TopDocs matches = null;
    matches = indexsearcher.search(query1,20);

    As per my understanding I should atleast one document as result.

    Is any one has idea what I can do to implement this serach.
    Thanks in Advance.

    --Madhu.
    Hi Madhu,

    Check query1 and compare what you expected:

    Query query1 = mlt.like(1); // mlt.like(docnumber)
    System.out.println(query1.toString());

    And if it is not what you expected, check min/max docFreq/termFreq/termLength
    setter/getter methods described in MLT javadoc.

    Koji
    --
    http://www.rondhuit.com/en/

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
    For additional commands, e-mail: java-user-help@lucene.apache.org
  • Madhuri madhuri at Mar 19, 2011 at 7:32 pm
    Hi Koji,

    Thanks for your reply... It is working now by setting doc and term frequency.

    Regards,
    Madhu.



    ________________________________
    From: Koji Sekiguchi <koji@r.email.ne.jp>
    To: java-user@lucene.apache.org
    Sent: Fri, 18 March, 2011 5:49:15 PM
    Subject: Re: Regarding MoreLikeThis similarity Search

    (11/03/19 6:16), madhuri_1820@yahoo.com wrote:
    Hi,

    I am new to lucene ... I have a question while implementing similarity search
    using MoreLikeThis query. I have written a small program but it is not giving
    any results. In my index file I have both strored and unstored(analyzed) fields.

    Sample Code :

    IndexReader ir = IndexReader.open(index directory path);
    IndexSearcher indexsearcher = new ProfileIndexSearcher(ir);
    IndexSearcher indexsearcher = new IndexSearcher(ir);
    MoreLikeThis mlt = new MoreLikeThis(ir);
    Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30);
    mlt.setAnalyzer(analyzer);
    mlt.setFieldNames(string_of_fields);

    Query query1 = mlt.like(1); // mlt.like(docnumber)
    TopDocs matches = null;
    matches = indexsearcher.search(query1,20);

    As per my understanding I should atleast one document as result.

    Is any one has idea what I can do to implement this serach.
    Thanks in Advance.

    --Madhu.
    Hi Madhu,

    Check query1 and compare what you expected:

    Query query1 = mlt.like(1); // mlt.like(docnumber)
    System.out.println(query1.toString());

    And if it is not what you expected, check min/max docFreq/termFreq/termLength
    setter/getter methods described in MLT javadoc.

    Koji
    --
    http://www.rondhuit.com/en/

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupjava-user @
categorieslucene
postedMar 18, '11 at 9:16p
activeMar 19, '11 at 7:32p
posts3
users2
websitelucene.apache.org

2 users in discussion

Madhuri madhuri: 2 posts Koji Sekiguchi: 1 post

People

Translate

site design / logo © 2022 Grokbase