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§
Constants§
- THRESHOLD
- Score from which a name counts as similar.
Functions§
- likely_
duplicates - The items most similar to
name(best first, at mostlimit), of the same type when one is given;excludeleaves 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"].