Hi Robert, what do you need the score for? Effectively the score is meaningful just within a query and a result set in a specific index snapshot i.e. just useful for debugging purposes
I have been working extensively with this feature, I would recommend using the MLT query parser, both for debugging purposes to see the query generated (with the interesting terms) and to return the score. I have in my *very long* to-do list to add a way to add a probabilistic score [0-1] for MLT. Unfortunately, I don't have a quick answer for your problem, I should go back to investigate why you can not return the score as any other field with that request handler (fl=score,*). Cheers -------------------------- Alessandro Benedetti Apache Lucene/Solr Committer Director, R&D Software Engineer, Search Consultant www.sease.io On Fri, 18 Jun 2021 at 09:38, Robert Wenig <[email protected]> wrote: > I am using Solr to search for "more like this" content. The field which > mlt should operate on has normally the length of a sentence. So I am > actually searching for mlt sentences. > > I have configured a mlt request handler in the solrconfig.xml > > <requestHandler name="/mlt" class="solr.MoreLikeThisHandler"> > > <str name="mlt.fl">content</str> > > <str name="mlt.mintf">0</str> > > <str name="mlt.mindf">0</str> > > </requestHandler> > > The corresponding schema.xml > > <schema name="MyAppSchema" version="1.6"> > > > > <field name="content" type="text_mlt" indexed="true" stored="true" > required="true" /> > > > > <fieldType name="text_mlt" class="solr.TextField" termVectors="true" > > > <analyzer type="index"> > > <tokenizer class="solr.StandardTokenizerFactory"/> > > <filter class="solr.StopFilterFactory" ignoreCase="true" > words="stopwords.txt" /> > > <filter class="solr.LowerCaseFilterFactory"/> > > </analyzer> > > <analyzer type="query"> > > <tokenizer class="solr.StandardTokenizerFactory"/> > > <filter class="solr.StopFilterFactory" ignoreCase="true" > words="stopwords.txt" /> > > <filter class="solr.SynonymGraphFilterFactory" > synonyms="synonyms.txt" ignoreCase="true" expand="true"/> > > <filter class="solr.LowerCaseFilterFactory"/> > > </analyzer> > > </fieldType> > > > > </schema> > > When I am now execute requests against this mlt RequestHandler I get > results but without the matching score. Is it possible to return the score > too when using the Request Handler? > > One example in the documentation displays the score of mlt but only when > using the SearchHandler< > https://solr.apache.org/guide/8_8/morelikethis.html#search-component-query-and-response>. > Should I use the Searchhandler to get the score? Are there any drawbacks > when using the SearchHandler over the MLT Request Handler? > >
