simserver.SimServer.optimize

SimServer.optimize(*args, **kwargs)[source]

Precompute top similarities for all indexed documents. This speeds up find_similar queries by id (but not queries by fulltext).

Internally, documents are moved from a fresh index (=no precomputed similarities) to an optimized index (precomputed similarities). Similarity queries always query both indexes, so this split is transparent to clients.

If you add documents later via index, they go to the fresh index again. To precompute top similarities for these new documents too, simply call optimize again.