Skip to main content

Module duplicates

Module duplicates 

Source
Expand description

Likely duplicate items by name: before (or right after) an item is created, the items whose latest revision has a similar name are offered, so an existing part is reused instead of created twice. Read-only and limited to the items the actor may read.

The candidates come from SQL (a name containing one of the words of the new name, at most CANDIDATES); the similarity is computed here, so it works without the optional pg_trgm extension.

Structs§

Duplicate

Constants§

THRESHOLD
Score from which a name counts as similar.

Functions§

likely_duplicates
The items most similar to name (best first, at most limit), of the same type when one is given; exclude leaves out an item (the one just created).
similarity
Similarity of two names, 0..1: the better of the word overlap (Jaccard) and the edit similarity of the names without spaces and punctuation, so both “Bracket left M8” / “M8 bracket left” and “Brakcet” / “Bracket” count as similar.
words
Lower-case words of a name (letters and digits, at least two characters), each once: "Bracket, M8 – left" → ["bracket", "m8", "left"].