Just a note that field boosting with the MLT Query Parser is broken, and for SolrCloud the whole thing is practically unusable if you index stuff in English because CloudMLTQParser includes strings from field definitions (such as "stored" and "indexed") in the query. I'm still hoping someone will review https://issues.apache.org/jira/browse/SOLR-9644, which contains a fix, at some point..

--Ere

24.12.2016, 1.26, Anshum Gupta kirjoitti:
Hi Todd,

You can query for similar documents using the MLT Query Parser. The code
would look something like:

// Assuming you want to use CloudSolrClient
CloudSolrClient client = new CloudSolrClient.Builder()
        .withZkHost(zkHost)
        .build();
    client.setDefaultCollection(COLLECTION_NAME);
QueryResponse queryResponse = client.query(new SolrQuery("{!mlt
qf=foo}docId"));

Notice the *docId*, *qf*, and the *!mlt* part.
docId - External document ID/unique ID of the document you want to query for
qf - fields that you want to use for similarity (you can read more about it
here:
https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-MoreLikeThisQueryParser
)
!mlt - the query parser you want to use.


On Thu, Dec 22, 2016 at 3:01 PM <todd_peter...@mgtsciences.com> wrote:

I am having trouble locating a decent example for using the MLT Java API
in Solr 6.3. What I want is to retrieve document IDs that are similar to a
given document ID.

Todd Peterson
Chief Embedded Systems Engineer
Management Sciences, Inc.
6022 Constitution Ave NE
Albuquerque, NM 87144
505-255-8611 <(505)%20255-8611> (office)
505-205-7057 <(505)%20205-7057> (cell)


--
Ere Maijala
Kansalliskirjasto / The National Library of Finland

Reply via email to