Using MoreLike This Component in Solr

Posted By : Jasgeet Singh | 09-May-2013

The MLT request handler will give MLT results based on a specific indexed document. This is commonly used in reaction to a user clicking a "more like this" link on existing search results. The key input to this option is a reference to the indexed document that you want similar results for.

MLT Search Component

MLT Parameters

params

Description

mlt

true to enable MoreLikeThis results

mlt.count

The number of similar documents to return for each result.

 

params

Description

mlt.fl

A comma or space separated list of fields to consider in MLT. The interesting terms are searched within these fields only, then each field should ideally have either termVectors or stored set to true in the schema.

mlt.qf

Different field boosts can optionally be specified with this parameter. The fields referenced should also be listed in mlt.fl. If there is a title or similar identifying field, then this field should probably be boosted higher.

mlt.mintf

The minimum number of times a term must be used within a document (across those fields in mlt.fl ) for it to be an interesting term. The default is 2.

mlt.mindf

The minimum number of documents that a term must be used in for it to be an interesting term. It defaults to 5.

mlt.minwl

The minimum number of characters in an interesting term. It defaults to 0.

mlt.maxwl

The maximum number of characters in an interesting term. It defaults to 0.

mlt.maxqt

The maximum number of interesting terms that will be used in an MLT query. It is limited to 25 by default, which is plenty.

mlt.maxntp

The maximum number of tokens to parse in each example doc field that is not stored with TermVector support. It default to 5000.

mlt.boost

This boolean toggles whether or not to boost each interesting term used in the MLT query. It default to false.

 

The MLT request handler needs to be configured in solrconfig.xml.

	<requestHandler name="mlt_tracks" class="solr.MoreLikeThisHandler">

	<lst name="defaults">

	<str name="mlt.fl">category, specialities</str>

	<str name="mlt.mintf">1</str>

	<str name="mlt.mindf">2</str>

	<str name="mlt.boost">true</str>

	</lst>

	</requestHandler>

Configure schema.xml:

  1. <field name="category"  type="textProcessed" indexed="true" stored="false" multiValued="true" termVectors="true"/>
   2. <field name="specialities" type="textProcessed" indexed="true" stored="false" multiValued="true" termVectors="true"/>

 

Solr Query:

This query returns similar documents for each document in the response set. Perhaps this should    be called "MoreLikeThese".

http://localhost:8080/solr/select/?qt=mlt&q=id:11&mlt.fl=category,specialities&fl=id&rows=5

 

 

About Author

Author Image
Jasgeet Singh

Jasgeet is a Sr. Lead developer .He is an experienced Groovy and Grails and has worked on designing & developing B2B and B2C portals using Grails technologies.

Request for Proposal

Name is required

Comment is required

Sending message..