Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-69

PATCH:MoreLikeThis support

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 1.3
    • search
    • None

    Description

      Here's a patch that implements simple support of Lucene's MoreLikeThis class.

      The MoreLikeThisHelper code is heavily based on (hmm..."lifted from" might be more appropriate Erik Hatcher's example mentioned in http://www.mail-archive.com/solr-user@lucene.apache.org/msg00878.html

      To use it, add at least the following parameters to a standard or dismax query:

      mlt=true
      mlt.fl=list,of,fields,which,define,similarity

      See the MoreLikeThisHelper source code for more parameters.

      Here are two URLs that work with the example config, after loading all documents found in exampledocs in the index (just to show that it seems to work - of course you need a larger corpus to make it interesting):

      http://localhost:8983/solr/select/?stylesheet=&q=apache&qt=standard&mlt=true&mlt.fl=manu,cat&mlt.mindf=1&mlt.mindf=1&fl=id,score

      http://localhost:8983/solr/select/?stylesheet=&q=apache&qt=dismax&mlt=true&mlt.fl=manu,cat&mlt.mindf=1&mlt.mindf=1&fl=id,score

      Results are added to the output like this:
      <response>
      ...
      <lst name="moreLikeThis">
      <result name="UTF8TEST" numFound="1" start="0" maxScore="1.5293242">
      <doc>
      <float name="score">1.5293242</float>
      <str name="id">SOLR1000</str>
      </doc>
      </result>
      <result name="SOLR1000" numFound="1" start="0" maxScore="1.5293242">
      <doc>
      <float name="score">1.5293242</float>
      <str name="id">UTF8TEST</str>
      </doc>
      </result>
      </lst>

      I haven't tested this extensively yet, will do in the next few days. But comments are welcome of course.

      Attachments

        1. lucene-queries-2.0.0.jar
          23 kB
          Bertrand Delacretaz
        2. lucene-queries-2.1.1-dev.jar
          23 kB
          Ryan McKinley
        3. SOLR-69.patch
          10 kB
          Ryan McKinley
        4. SOLR-69.patch
          9 kB
          Bertrand Delacretaz
        5. SOLR-69.patch
          9 kB
          Bertrand Delacretaz
        6. SOLR-69.patch
          9 kB
          Bertrand Delacretaz
        7. SOLR-69-MoreLikeThisRequestHandler.patch
          22 kB
          Ryan McKinley
        8. SOLR-69-MoreLikeThisRequestHandler.patch
          22 kB
          Ryan McKinley
        9. SOLR-69-MoreLikeThisRequestHandler.patch
          15 kB
          Ryan McKinley
        10. SOLR-69-MoreLikeThisRequestHandler.patch
          12 kB
          Ryan McKinley
        11. SOLR-69-MoreLikeThisRequestHandler.patch
          8 kB
          Ryan McKinley

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ryantxu Ryan McKinley
            bdelacretaz Bertrand Delacretaz
            Votes:
            3 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment