diff --git a/README.md b/README.md index e18a00c..ed9ea73 100644 --- a/README.md +++ b/README.md @@ -50,9 +50,8 @@ writer.commit() index.reload() searcher = index.searcher() query = index.parse_query("fish days", ["title", "body"]) -top_docs = tantivy.TopDocs(3) -(best_score, best_doc_address) = searcher.search(query, top_docs)[0] +(best_score, best_doc_address) = searcher.search(query, 3).hits[0] best_doc = searcher.doc(best_doc_address) assert best_doc["title"] == ["The Old Man and the Sea"] print(best_doc) diff --git a/src/lib.rs b/src/lib.rs index 4eaffbb..680fe6d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,11 +61,9 @@ use searcher::{DocAddress, Searcher}; /// >>> reader = index.reader() /// >>> searcher = reader.searcher() /// -/// >>> query_parser = tantivy.QueryParser.for_index(index, [title, body]) -/// >>> query = query_parser.parse_query("sea whale") +/// >>> query = index.parse_query("sea whale", [title, body]) /// -/// >>> top_docs = tantivy.TopDocs.with_limit(10) -/// >>> result = searcher.search(query, top_docs) +/// >>> result = searcher.search(query, 10) /// /// >>> assert len(result) == 1 ///