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

SolrJ client java does not support moreLikeThis querys and results

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.3, 7.0
    • Component/s: clients - java
    • Labels:
      None
    • Environment:

      SolrJ java client

      Description

      Although SOLR supports the more like this querys (see http://wiki.apache.org/solr/MoreLikeThis) these type of query are currently not supported by the SOLR java client.

      1. SOLR-1085.4.2.1.patch
        11 kB
        Bill Mitchell
      2. SOLR-1085.patch
        16 kB
        Shalin Shekhar Mangar
      3. SOLR-1085.patch
        16 kB
        Cao Manh Dat
      4. SOLR-1085.patch
        4 kB
        Cao Manh Dat
      5. SOLR-1085.patch
        21 kB
        Juan Grande
      6. solrj-java-morelikethis.patch
        33 kB
        Maurice Jumelet

        Activity

        Hide
        maurice@jumelet.net Maurice Jumelet added a comment -

        Attached is a patch that adds minimal support to the solr java client for morelikethis support.

        Tobe done: add all query parameters as defined at: http://wiki.apache.org/solr/MoreLikeThis

        Show
        maurice@jumelet.net Maurice Jumelet added a comment - Attached is a patch that adds minimal support to the solr java client for morelikethis support. Tobe done: add all query parameters as defined at: http://wiki.apache.org/solr/MoreLikeThis
        Hide
        shalinmangar Shalin Shekhar Mangar added a comment -

        Maurice, this patch is based on the 1.3.0 release branch. There has been a lot of changes in the code base since that release. Can you please provide one which applies on the trunk?

        Also, there seems to be some character encoding issues in the patch. Can you make sure that you use UTF-8?

        Show
        shalinmangar Shalin Shekhar Mangar added a comment - Maurice, this patch is based on the 1.3.0 release branch. There has been a lot of changes in the code base since that release. Can you please provide one which applies on the trunk? Also, there seems to be some character encoding issues in the patch. Can you make sure that you use UTF-8?
        Hide
        shalinmangar Shalin Shekhar Mangar added a comment -

        Marking for 1.5

        Show
        shalinmangar Shalin Shekhar Mangar added a comment - Marking for 1.5
        Hide
        mdiggory Mark Diggory added a comment -

        Given this patch doesn't alter any existing methods, but instead adds methods to supoort the existing MLT behavior already present in Solr. It would seem wise to get it off the queue and into 1.4 so that it won't get stale.

        Show
        mdiggory Mark Diggory added a comment - Given this patch doesn't alter any existing methods, but instead adds methods to supoort the existing MLT behavior already present in Solr. It would seem wise to get it off the queue and into 1.4 so that it won't get stale.
        Hide
        shalinmangar Shalin Shekhar Mangar added a comment -

        Given this patch doesn't alter any existing methods, but instead adds methods to supoort the existing MLT behavior already present in Solr. It would seem wise to get it off the queue and into 1.4 so that it won't get stale.

        Mark, the patch is stale. It does not apply on 1.4 trunk. It is too late in the release cycle to add it to 1.4 but if you or somebody else can sync it with trunk, we can commit it for 1.5.

        Show
        shalinmangar Shalin Shekhar Mangar added a comment - Given this patch doesn't alter any existing methods, but instead adds methods to supoort the existing MLT behavior already present in Solr. It would seem wise to get it off the queue and into 1.4 so that it won't get stale. Mark, the patch is stale. It does not apply on 1.4 trunk. It is too late in the release cycle to add it to 1.4 but if you or somebody else can sync it with trunk, we can commit it for 1.5.
        Hide
        hossman Hoss Man added a comment -

        Bulk updating 240 Solr issues to set the Fix Version to "next" per the process outlined in this email...

        http://mail-archives.apache.org/mod_mbox/lucene-dev/201005.mbox/%3Calpine.DEB.1.10.1005251052040.24672@radix.cryptio.net%3E

        Selection criteria was "Unresolved" with a Fix Version of 1.5, 1.6, 3.1, or 4.0. email notifications were suppressed.

        A unique token for finding these 240 issues in the future: hossversioncleanup20100527

        Show
        hossman Hoss Man added a comment - Bulk updating 240 Solr issues to set the Fix Version to "next" per the process outlined in this email... http://mail-archives.apache.org/mod_mbox/lucene-dev/201005.mbox/%3Calpine.DEB.1.10.1005251052040.24672@radix.cryptio.net%3E Selection criteria was "Unresolved" with a Fix Version of 1.5, 1.6, 3.1, or 4.0. email notifications were suppressed. A unique token for finding these 240 issues in the future: hossversioncleanup20100527
        Hide
        renaudrichardet Renaud Richardet added a comment -

        For the record, this workaround (proposed from Bruce Ritchie on http://www.mail-archive.com/solr-user@lucene.apache.org/msg14525.html) worked for me:

        #1 - Define the mlt handles in solrconfig.xml (it's not defined in the example
        solrconfig.xml I was using):

        <requestHandler name="/mlt" class="solr.MoreLikeThisHandler" />

        #2 - with Solrj, access the mlt handler via something similar to the following:

        query.setQueryType("/" + MoreLikeThisParams.MLT);
        query.set(MoreLikeThisParams.MATCH_INCLUDE, false);
        query.set(MoreLikeThisParams.MIN_DOC_FREQ, 1);
        query.set(MoreLikeThisParams.MIN_TERM_FREQ, 1);
        query.set(MoreLikeThisParams.SIMILARITY_FIELDS, "subject,body");
        query.setQuery("Your query here or in my case the unique key field:value");

        Show
        renaudrichardet Renaud Richardet added a comment - For the record, this workaround (proposed from Bruce Ritchie on http://www.mail-archive.com/solr-user@lucene.apache.org/msg14525.html ) worked for me: #1 - Define the mlt handles in solrconfig.xml (it's not defined in the example solrconfig.xml I was using): <requestHandler name="/mlt" class="solr.MoreLikeThisHandler" /> #2 - with Solrj, access the mlt handler via something similar to the following: query.setQueryType("/" + MoreLikeThisParams.MLT); query.set(MoreLikeThisParams.MATCH_INCLUDE, false); query.set(MoreLikeThisParams.MIN_DOC_FREQ, 1); query.set(MoreLikeThisParams.MIN_TERM_FREQ, 1); query.set(MoreLikeThisParams.SIMILARITY_FIELDS, "subject,body"); query.setQuery("Your query here or in my case the unique key field:value");
        Hide
        rcmuir Robert Muir added a comment -

        Bulk move 3.2 -> 3.3

        Show
        rcmuir Robert Muir added a comment - Bulk move 3.2 -> 3.3
        Hide
        juangrande Juan Grande added a comment -

        Attached is a patch that adds MoreLikeThis support to SolrJ. The patch is for the trunk, but if necessary I can backport it to the 3x branch.

        Show
        juangrande Juan Grande added a comment - Attached is a patch that adds MoreLikeThis support to SolrJ. The patch is for the trunk, but if necessary I can backport it to the 3x branch.
        Hide
        rcmuir Robert Muir added a comment -

        3.4 -> 3.5

        Show
        rcmuir Robert Muir added a comment - 3.4 -> 3.5
        Hide
        hossman Hoss Man added a comment -

        Bulk of fixVersion=3.6 -> fixVersion=4.0 for issues that have no assignee and have not been updated recently.

        email notification suppressed to prevent mass-spam
        psuedo-unique token identifying these issues: hoss20120321nofix36

        Show
        hossman Hoss Man added a comment - Bulk of fixVersion=3.6 -> fixVersion=4.0 for issues that have no assignee and have not been updated recently. email notification suppressed to prevent mass-spam psuedo-unique token identifying these issues: hoss20120321nofix36
        Hide
        steve_rowe Steve Rowe added a comment -

        Bulk move 4.4 issues to 4.5 and 5.0

        Show
        steve_rowe Steve Rowe added a comment - Bulk move 4.4 issues to 4.5 and 5.0
        Hide
        wtmitchell3 Bill Mitchell added a comment -

        I have relocated the above SOLR-1085 patch to version 4.2.1 (that's the version my shop is running currently). As the earlier version of the patch did a little more than fix this problem – it also added some new entry points that might make MLT easier to use from Java, but these new methods raised some new questions – I removed those and modified the included MLT JUnit test to use just the already defined parameters directly.

        I also updated the JUnit test added to SolrExampleTests to verify that SOLR-5042 has also been fixed. This should not be a problem when relocated to solr 4.6, as that fix is already included there.

        Show
        wtmitchell3 Bill Mitchell added a comment - I have relocated the above SOLR-1085 patch to version 4.2.1 (that's the version my shop is running currently). As the earlier version of the patch did a little more than fix this problem – it also added some new entry points that might make MLT easier to use from Java, but these new methods raised some new questions – I removed those and modified the included MLT JUnit test to use just the already defined parameters directly. I also updated the JUnit test added to SolrExampleTests to verify that SOLR-5042 has also been fixed. This should not be a problem when relocated to solr 4.6, as that fix is already included there.
        Hide
        thetaphi Uwe Schindler added a comment -

        Move issue to Solr 4.9.

        Show
        thetaphi Uwe Schindler added a comment - Move issue to Solr 4.9.
        Hide
        caomanhdat Cao Manh Dat added a comment -

        Updated patch for lastest code of this issue.

        Show
        caomanhdat Cao Manh Dat added a comment - Updated patch for lastest code of this issue.
        Hide
        shalinmangar Shalin Shekhar Mangar added a comment -

        Hi Dat, your patch does not have any changes to SolrQuery like the ones made by previous patches. Did you forget to include all files in the patch?

        Show
        shalinmangar Shalin Shekhar Mangar added a comment - Hi Dat, your patch does not have any changes to SolrQuery like the ones made by previous patches. Did you forget to include all files in the patch?
        Hide
        caomanhdat Cao Manh Dat added a comment -

        That's my mistake, I will reupload another patch soon.

        Show
        caomanhdat Cao Manh Dat added a comment - That's my mistake, I will reupload another patch soon.
        Hide
        caomanhdat Cao Manh Dat added a comment -

        Updated patch, that support for change MoreLikeThis parameters inside SolrQuery.

        Show
        caomanhdat Cao Manh Dat added a comment - Updated patch, that support for change MoreLikeThis parameters inside SolrQuery.
        Hide
        shalinmangar Shalin Shekhar Mangar added a comment -

        Thanks Dat. This patch adds some javadocs to make precommit happy. I'll commit this shortly.

        Show
        shalinmangar Shalin Shekhar Mangar added a comment - Thanks Dat. This patch adds some javadocs to make precommit happy. I'll commit this shortly.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 2172f3e0081e3e59ce8b02c2bb5654a592f79f74 in lucene-solr's branch refs/heads/master from Shalin Shekhar Mangar
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=2172f3e ]

        SOLR-1085: Add support for MoreLikeThis queries and responses in SolrJ client

        Show
        jira-bot ASF subversion and git services added a comment - Commit 2172f3e0081e3e59ce8b02c2bb5654a592f79f74 in lucene-solr's branch refs/heads/master from Shalin Shekhar Mangar [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=2172f3e ] SOLR-1085 : Add support for MoreLikeThis queries and responses in SolrJ client
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 6400b9c3cb954d7bf88a8f4f2c4975ad8af2308b in lucene-solr's branch refs/heads/branch_6x from Shalin Shekhar Mangar
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=6400b9c ]

        SOLR-1085: Add support for MoreLikeThis queries and responses in SolrJ client

        (cherry picked from commit 2172f3e)

        Show
        jira-bot ASF subversion and git services added a comment - Commit 6400b9c3cb954d7bf88a8f4f2c4975ad8af2308b in lucene-solr's branch refs/heads/branch_6x from Shalin Shekhar Mangar [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=6400b9c ] SOLR-1085 : Add support for MoreLikeThis queries and responses in SolrJ client (cherry picked from commit 2172f3e)
        Hide
        shalinmangar Shalin Shekhar Mangar added a comment -

        Thanks Maurice, Bill and Dat!

        Show
        shalinmangar Shalin Shekhar Mangar added a comment - Thanks Maurice, Bill and Dat!
        Hide
        shalinmangar Shalin Shekhar Mangar added a comment -

        Closing after 6.3.0 release.

        Show
        shalinmangar Shalin Shekhar Mangar added a comment - Closing after 6.3.0 release.

          People

          • Assignee:
            shalinmangar Shalin Shekhar Mangar
            Reporter:
            maurice@jumelet.net Maurice Jumelet
          • Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development