diff --git a/src/documents/index.py b/src/documents/index.py index e3b71f905..62d3b822a 100644 --- a/src/documents/index.py +++ b/src/documents/index.py @@ -108,8 +108,6 @@ def query_index(ix, querystr): def autocomplete(ix, term, limit=10): with ix.reader() as reader: terms = [] - for t in reader.expand_prefix("content", term.lower()): + for (score, t) in reader.most_distinctive_terms("content", limit, term.lower()): terms.append(t) - if len(terms) >= limit: - break return terms