There are two ways to access MoreLikeThis from solr: from the MoreLikeThisHandler or with the StandardRequestHandler.
Contents
TermVectors, Analyzers and MoreLikeThis
MoreLikeThis constructs a lucene query based on terms within a document. For best results, use stored TermVectors in the schema.xml for fields you will use for similarity.
<field name="cat" ... termVectors="true" />
If termVectors are not stored, MoreLikeThis will generate terms from stored fields.
Common Parameters
param |
description |
mlt.fl |
The fields to use for similarity. NOTE: if possible, these should have a stored TermVector |
mlt.mintf |
Minimum Term Frequency - the frequency below which terms will be ignored in the source doc. |
mlt.mindf |
Minimum Document Frequency - the frequency at which words will be ignored which do not occur in at least this many docs. |
mlt.minwl |
minimum word length below which words will be ignored. |
mlt.maxwl |
maximum word length above which words will be ignored. |
mlt.maxqt |
maximum number of query terms that will be included in any generated query. |
mlt.maxntp |
maximum number of tokens to parse in each example doc field that is not stored with TermVector support. |
mlt.boost |
[true/false] set if the query will be boosted by the interesting term relevance. |
mlt.qf |
Query fields and their boosts using the same format as that used in DisMaxRequestHandler. These fields must also be specified in mlt.fl. |
StandardRequestHandler
This method returns similar documents for each document in the response set. Perhaps this should be called "MoreLikeThese"
param |
description |
mlt |
'true' to enable MoreLikeThis results |
mlt.count |
The number of similar documents to return for each result. |
examples
MoreLikeThisHandler
When you specifically want information about similar documents, you can use the MoreLikeThisHandler.
If you want to filter the similar results given by MoreLikeThis you have to use the MoreLikeThisHandler. It will consider the similar document result set as the main one so will apply the specified filters (fq) on it. If you use the MoreLikeThisComponent and apply query filters it will be applyed to the result set returned by the main query (QueryComponent) and not to the one returned by the MoreLikeThisComponent.
Debugging
As of 11/14/2008 there currently does not exist a way to see why solr recommended alternative products via the SearchComponent. While it is true that debugQuery can be used it does not appear to contain the data for this component.