MEntity::full_name
and full_name
Use the Levenshtein algorithm on all the indexed mentities full_name
.
Warning: may not scale to large indexes.
# Rank all mentities by the distance between `MEntity::full_name` and `full_name`
#
# Use the Levenshtein algorithm on all the indexed mentities `full_name`.
# Warning: may not scale to large indexes.
fun find_by_full_name_similarity(name: String, filter: nullable ModelFilter): IndexMatches do
var results = new IndexMatches
for match in full_name_distances.search(name) do
var dist = match.distance
var mname = match.key
if not full_names.has_key(mname) then continue
var mentity = full_names[mname]
if mentity isa MClassDef or mentity isa MPropDef then continue
if filter != null and not filter.accept_mentity(mentity) then continue
results.add new IndexMatch(mentity, dist)
end
return results
end
src/model/model_index.nit:375,2--391,4