Different tantivy index writer per handler #1898
-
Hi, I'm new to axum and rust, so bear with me. I'm trying to create a small search engine with axum and tantivy. As tantivy docs said only one index writer is allowed, and is thread safe. I have different things to index (articles, questions and products), so I will have one index writer per entity and one handler for each entity to index. How can I pass those index writers to different handlers? something like a map of index writers and use a state with the map? or shall I use another mechanism? I was thinking in function currying, a function that takes an index writer and returns you an axum handler, but it's not an easy task. Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
https://docs.rs/axum/0.6.12/axum/#sharing-state-with-handlers |
Beta Was this translation helpful? Give feedback.
https://docs.rs/axum/0.6.12/axum/#sharing-state-with-handlers