Skip to content

web search done right

less confusion between searcher and tantivy::Searcher

Mikkel Denker06fde74b37a8
diff --git a/src/index.rs b/src/index.rs
index d987ba1e..a4c759d6 100644
--- a/src/index.rs
+++ b/src/index.rs
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use tantivy::collector::{Collector, Count};
-use tantivy::{DocAddress, Document, LeasedItem, Searcher};
+use tantivy::{DocAddress, Document, LeasedItem};
use crate::query::Query;
use crate::schema::{create_schema, Field, ALL_FIELDS};
@@ -88,7 +88,7 @@ impl Index {
fn retrieve_doc(
doc_address: DocAddress,
- searcher: &LeasedItem<Searcher>,
+ searcher: &LeasedItem<tantivy::Searcher>,
) -> Result<RetrievedWebpage> {
let doc = searcher.doc(doc_address)?;
Ok(RetrievedWebpage::from(doc))
diff --git a/src/snippet.rs b/src/snippet.rs
index 344f0990..da1ac0b2 100644
--- a/src/snippet.rs
+++ b/src/snippet.rs
@@ -14,7 +14,6 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
-use tantivy::Searcher as TantivySearcher;
use tantivy::SnippetGenerator;
use crate::{query::Query, schema::Field, Result};
@@ -23,7 +22,7 @@ use crate::{query::Query, schema::Field, Result};
/// In the future we want to implement something closer to the method described in https://cs.pomona.edu/~dkauchak/ir_project/whitepapers/Snippet-IL.pdf.
/// This will require us to store each paragraph of the webpage separately to get adequate performance.
/// Implementing SnippetIL will also allow us to correctly add "..." to the snippet.
-pub fn generate(query: &Query, text: &str, searcher: &TantivySearcher) -> Result<String> {
+pub fn generate(query: &Query, text: &str, searcher: &tantivy::Searcher) -> Result<String> {
let generator = SnippetGenerator::create(
searcher,
&query.tantivy(searcher.schema(), searcher.index().tokenizers()),