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)

Reply via email to