We might not get relevant results with keywords all the time, so we need to find similar results based on a document; something like what Google provides, as shown in the following image:
MoreLikeThis is a component to find documents that are most similar to a document. It does this using terms from the original document to find similar documents in the index. In this recipe, you will learn different approaches to using this component.
For this recipe, we will use the same product and their blog items and both will have Title
and Description
fields, on which we will perform a MoreLikeThis search.
First of all, we will implement a search query without boosting and get results:
We will use the
Product
document mapper class withproductname
(ortitle
) anddescription
fields that we created in the previous recipe.Write code to search and list results based on a search keyword so that we will get the following results. Here, to each result is...