Hi,

As far as I know, there's no specific method to get the MoreLikeThis section
from the response. Anyway, you can retrieve the results with a piece of code
like the following:

// the <lst name="moreLikeThis"> is a NamedList of SolrDocumentLists
> NamedList<SolrDocumentList> mltResult =
> (NamedList<SolrDocumentList>)response.getResponse().get("moreLikeThis");
> for(Map.Entry<String, SolrDocumentList> entry: mltResult) {
>     System.out.println("Docs similar to " + entry.getKey());
>     for(SolrDocument similarDoc: entry.getValue()) {
>         System.out.println(" -> " + similarDoc.get("id"));
>     }
> }
>

Hope that helps!

*Juan*



On Fri, Jul 1, 2011 at 3:04 PM, Sheetal <rituzprad...@gmail.com> wrote:

> Hi,
> I am beginner in Solr. I am trying to read data from Solr MoreLike This
> through Java. My query is
>
> http://localhost:8983/solr/select?q=repository_id:20&mlt=true&mlt.fl=filename&mlt.mindf=1&mlt.mintf=1&debugQuery=on&mlt.interestingTerms=detail
>
>
> I wanted to read the data of the field "moreLikeThis" from output <lst
> name="moreLikeThis">.
> The main idea is, after I do moreLikeThis, then all fieldValue of
> "moreLikeThis" should print out in my program.
>
> I figured out the way to read the "Result" tag by doing QueryResponse
> rsp.getResults() and looping out.
>
> But How would I read and print the values of "moreLikeThis" tag? Is there
> anyway class like rsp.getMoreLikeThisField(fieldname) or something.....
>
>
> Thank you in advance. :)
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Reading-data-from-Solr-MoreLikeThis-tp3130184p3130184.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to