The search method supports a range of search algorithms.
It is recommended to tune the index by calling
$table->set(top=>1) after bulk inserting the documents into the table.
This is a computing intense operation and all inserts and deletes after this optimization are slightly more expensive.
the index is kept sorted automatically until you switch the optimization off by calling
When searching a tuned index,
a query can be processed faster if the caller requests only the topmost documents.
This can be done by passing a
top => n parameter to the search method.
For single term queries,
the method returns only the n top ranking documents.
For multi term queries two optimized algorithms are available.
The first algorithm computes the top n documents approximately but very fast,
sacrificing a little bit of precision for speed.
The second algorithm computes the topmost n documents precisely.
This algorithm is slower and should be used only for small values of n.
It can be requested by passing the query attribute
picky => 1.
Both algorithms may return more than n hits.
While the picky version might not be faster than the brute force version on average for modest size databases it uses less memory and the processing time is almost linear in the number of query terms,
not in the size of the lists.