7 votes

Similarity

Similarity

The Umbraco v7 version of Similarity found in uComponents.  This version has the ability to filter on document types. You also get a macro included so you can use it on a template or in your rich text edit fields. In essence Similarity will get a list of nodes similar to the current one that you are viewing. 

Under the hood it uses Lucene and the Similarity contribution package. 

Install the package, create a data type based on Similarity, configure that datatype by providing it with the index to search on, the document types to search on and the document type properties to search on. Finally set the maximum number of documents to return.

Add the datatype to your document type. Now when you edit the document you will see a button called Find similar, clicking on this will find for you documents similar to the current one.  You can now select all or a subset of the documents that have been found.

Next you need to create a macro to display the results. One has already been installed for you called SimilarDocuments you can update this to display your results.  The macro has 2 lots of code. One form working in data type mode in this mode you are display the documents that YOU have selected. 

var docs = Model.Content.GetPropertyValue<Similarity.ValueConverter.Similar>("similarDocuments");

The other mode is blanket mode here you will get back all items that are similar you need to pass in all the parameters  

        using (var moreLikeThis = new MoreUmbracoDocsLikeThis(Model.Content.Id, index, maxNo, properties, docTypes))

        {

            var similardocs = moreLikeThis.FindMoreLikeThis(out query);

            @Html.Hidden("query",query)

            foreach (var result in similardocs)

            {

                <p>@result.PageName</p>

            }    

        }

Both modes are illustrated in the macro.  For a full working demo please view the screen cast on Vimeo 

https://vimeo.com/86717216

PLEASE NOTE PACKAGE DOES NOT WORK WITH 7.2 UPWARDS. HOWEVER YOU CAN DOWNLOAD FORKED SOURCE FROM https://bitbucket.org/jlane/similarity BUILD THAT AND COPY OVER SIMILARITY DLLS, THAT DOES WORK.

Screenshots

Package owner

Ismail Mayat

Ismail Mayat

Ismail has 9144 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
8.1.x (untested)
8.0.x (untested)
7.14.x (untested)
7.13.x (untested)
7.12.x (untested)
7.11.x (untested)
7.10.x (untested)
7.9.x (untested)
7.8.x (untested)
7.7.x (untested)
7.6.x (untested)
7.5.x (untested)
7.4.x (0%)
7.3.x (0%)
7.2.x (untested)
7.1.x (100%)
7.0.x (100%)
6.1.x (0%)
6.0.x (0%)

You must login before you can report on package compatibility.

Package Information

  • Package owner: Ismail Mayat
  • Contributors: Jordan Lane
  • Created: 17/02/2014
  • Current version 1.0
  • .net Version 4.0
  • License MIT
  • Downloads: 1295