Code Scope of Action:
Code First Added:
^similarTo( item, count[, start, list-item-prefix, list-item-suffix, end] )^
The HTML Export element ^similarTo^ locates notes that appear similar to a given note.
The query will find up to count notes, but may find fewer, and exports a list of notes it finds. The count parameter is not evaluated so must be stated as a value and not an expression.
Basic form, returning links to the 10 most similar notes:
The longer form is only needed if it is desired to use non-default list HTML mark-up or include extra per-item captioning. If one of the option input is specified, all the others must also be, even if only as the default value(s).
The code must be used in $Text or directly in a template. If used in a code include to a template, the links generated will have incorrect relative paths.
Similarity is based on several factors, including:
- the text of the note
- the note title
- any text contained in user attributes
In addition, weighting is applied for:
- notes having the same prototype
- notes having roughly similar amounts of text
From v.8.7.1, the export is relative to current rather than this, facilitating work with included files.