Like other search engines, Whoosh too provides more_like() and more_like_this() methods to find similar documents in the index, Typically, morelikethis doesnt execute any special query to get the list of similar documents to the one specified, but in fact it searches all other documents in the index relative to the document content that is specified. Here’s a example of more_like() method of Whoosh integrated with Tornado

User enters the document path and submits it to the index which then presents the similar morelike documents. User form code here

In the code below:

  • document_number(path=path) gets the document number of the specified document path in the index
  • more_like(docnum, ‘content’) method then find documents *like* the specified document based on content
  • more_like_this(“content”, top=1) method searches the top 1 sub-hits