server: add TODO

This commit is contained in:
Bill Thiede 2024-12-14 11:56:33 -08:00
parent 9fbfa378bb
commit a0eb8dcba6

View File

@ -194,6 +194,14 @@ impl TantivyConnection {
query: &Query,
) -> Result<(Searcher, Box<dyn query::Query>), ServerError> {
let index = self.get_index()?;
// TODO: only create one reader
// From https://tantivy-search.github.io/examples/basic_search.html
// "For a search server you will typically create one reader for the entire lifetime of
// your program, and acquire a new searcher for every single request."
//
// I think there's some challenge in making the reader work if we reindex, so reader my
// need to be stored indirectly, and be recreated on reindex
// I think creating a reader takes 200-300 ms.
let reader = index.reader()?;
let schema = index.schema();
let searcher = reader.searcher();