perlin/lib.rs
1//! Perlin is a free and open source information retrieval library.
2//!
3//! Version 0.1.0
4//!
5//! # Features
6//! * boolean retrieval on arbitrary types
7//! * minimal dependencies
8//! * lazy and zero-allocation query evaluation
9//!
10//! # Basic Usage
11//!
12//! Add Perlin to Cargo.toml
13//!
14//! ```toml
15//! [dependencies]
16//! perlin = "0.1"
17//! ```
18//!
19//! and import it in your crate root:
20//!
21//! ```rust
22//! extern crate perlin;
23//! ```
24//!
25//!
26//! ## Build index and run queries
27//! ```rust
28//! use perlin::index::Index;
29//! use perlin::storage::RamStorage;
30//! use perlin::index::boolean_index::{QueryBuilder, IndexBuilder};
31//!
32//! //Use `IndexBuilder` to construct a new Index and add documents to it.
33//! //Perlin does not dictate what "documents" are.
34//! //Rather it expects iterators over iterators over terms.
35//! //In our case a "document" consists of a series of `usize` values:
36//! let index = IndexBuilder::<_, RamStorage<_>>::new().create(vec![(0..10),
37//! (0..15), (10..34)].into_iter()).unwrap();
38//!
39//! //Now use the `QueryBuilder` to construct a query
40//! //Simple query for the number 4
41//! let simple_query = QueryBuilder::atom(4).build();
42//!
43//! //When executing queries the index does not evaluate return all results at once.
44//! //Rather it runs lazily and returns an iterator over the resulting document ids.
45//! for id in index.execute_query(&simple_query) {
46//! println!("{}", id); //Will print 0 and 1
47//! }
48//!
49//! ```
50//!
51//! Have a look in the [examples folder](https://github.com/JDemler/perlin/tree/master/examples) for more
52//! elaborate examples!
53//!
54//!
55#![deny(missing_docs, warnings)]
56
57#[macro_use]
58mod utils;
59pub mod language;
60pub mod index;
61pub mod storage;