1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! A Rust port of the core of [Apache Lucene](https://lucene.apache.org/) 10.5: the
//! Lucene104 postings format, BM25 scoring, Lucene's block-max top-k algorithms, segment-based
//! indexing with deletes and merges, analyzers and the classic query parser.
//!
//! On the benchmark corpus (469k Wikipedia articles) it returns the same top-10 documents with
//! bit-identical scores as Lucene 10.5.2, about 1.6–2x faster per query.
//!
//! # Quick start
//!
//! ```
//! use lucene_rs::{
//! DirectoryReader, Document, Field, IndexSearcher, IndexWriter, IndexWriterConfig, QueryParser,
//! StandardAnalyzer, Store,
//! };
//!
//! # fn main() -> lucene_rs::Result<()> {
//! # let tmp = tempfile::tempdir()?;
//! # let dir = tmp.path();
//! let mut writer = IndexWriter::open(dir, IndexWriterConfig::default())?;
//! writer.add_document(
//! &Document::new()
//! .with(Field::string("id", "1", Store::Yes))
//! .with(Field::text("title", "Rust in Action", Store::Yes))
//! .with(Field::text("body", "systems programming in rust", Store::No)),
//! )?;
//! writer.commit()?;
//!
//! let searcher = IndexSearcher::new(DirectoryReader::open(dir)?);
//! let query = QueryParser::new("body", StandardAnalyzer::new()).parse("\"systems programming\" title:rust")?;
//! let top = searcher.search(&query, 10)?;
//! assert_eq!(top.total_hits.value, 1);
//! let doc = searcher.doc(top.score_docs[0].doc)?;
//! assert_eq!(doc.get_str("title"), Some("Rust in Action"));
//! # Ok(())
//! # }
//! ```
//!
//! # Map
//!
//! - [`document`]: [`Document`], [`Field`], [`FieldType`] (text, keyword, stored fields).
//! - [`analysis`]: [`Analyzer`] and the standard, whitespace, simple and keyword analyzers.
//! - [`index`]: [`IndexWriter`] (add, update, delete, flush, merge, commit) and
//! [`DirectoryReader`] (a point-in-time view of a commit).
//! - [`search`]: [`Query`], [`BooleanQuery`], [`PhraseQuery`] and [`IndexSearcher`].
//! - [`queryparser`]: Lucene's classic query syntax.
//! - [`sim`]: BM25 and Lucene's one-byte norm encoding.
//!
//! The on-disk format follows Lucene104's postings layout but is not file-compatible with
//! Lucene: indexes written by one cannot be read by the other.
pub use ;
pub use ;
pub use ;
pub use SortValue;
pub use ;
pub use QueryParser;
pub use ;
pub use ;