Running more like this query using PHP
More like this feature of Solr can be used to construct a query based on the terms within a document. This feature helps us in retrieving documents similar to those in our query results. We have to specify the fields on which the more like this functionality is run. For efficiency purposes, it is recommended that we have termVectors=true
for these fields. Let us understand how this functionality works by looking at an example. Suppose we want books that are similar to those appearing in the result. Similarity of books is derived from the author and the series to which they belong. So we would have to tell Solr to get books similar to the currently selected book based on the fields' author
and series
. Solr (Lucene) internally compares all the tokens within the specified fields in all documents (books in our case) in the index with the fields of the currently selected book. And based on how many tokens are matching, it retrieves the results and ranks...