mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-06 01:02:55 +00:00
Compare commits
6 Commits
0.7.0
...
issue/weba
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
507e46f814 | ||
|
|
3d3da2d66f | ||
|
|
e0cdd3114d | ||
|
|
f32b4a2ebe | ||
|
|
6ff60b8ed8 | ||
|
|
8da28fb6cf |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
|
tantivy.iml
|
||||||
*.swp
|
*.swp
|
||||||
target
|
target
|
||||||
target/debug
|
target/debug
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ byteorder = "1.0"
|
|||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
regex = "1.0"
|
regex = "1.0"
|
||||||
fst = {version="0.3", default-features=false}
|
fst = {version="0.3", default-features=false}
|
||||||
fst-regex = { version="0.2" }
|
fst-regex = { version="0.2", optional=true}
|
||||||
lz4 = {version="1.20", optional=true}
|
lz4 = {version="1.20", optional=true}
|
||||||
snap = {version="0.2"}
|
snap = {version="0.2"}
|
||||||
atomicwrites = {version="0.2.2", optional=true}
|
atomicwrites = {version="0.2.2", optional=true}
|
||||||
@@ -60,7 +60,6 @@ maplit = "1"
|
|||||||
[profile.release]
|
[profile.release]
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
debug = false
|
debug = false
|
||||||
lto = true
|
|
||||||
debug-assertions = false
|
debug-assertions = false
|
||||||
|
|
||||||
[profile.test]
|
[profile.test]
|
||||||
@@ -69,8 +68,9 @@ overflow-checks = true
|
|||||||
|
|
||||||
[features]
|
[features]
|
||||||
# by default no-fail is disabled. We manually enable it when running test.
|
# by default no-fail is disabled. We manually enable it when running test.
|
||||||
default = ["mmap", "no_fail"]
|
default = ["mmap", "no_fail", "regex_query"]
|
||||||
mmap = ["fst/mmap", "atomicwrites"]
|
mmap = ["fst/mmap", "atomicwrites"]
|
||||||
|
regex_query = ["fst-regex"]
|
||||||
lz4-compression = ["lz4"]
|
lz4-compression = ["lz4"]
|
||||||
no_fail = ["fail/no_fail"]
|
no_fail = ["fail/no_fail"]
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ Tantivy is, in fact, strongly inspired by Lucene's design.
|
|||||||
|
|
||||||
# Non-features
|
# Non-features
|
||||||
|
|
||||||
- Distributed search and will not be in the scope of tantivy.
|
- Distributed search is out of the scope of tantivy. That being said, tantivy is meant as a
|
||||||
|
library upon which one could build a distributed search. Serializable/mergeable collector state for instance,
|
||||||
|
are within the scope of tantivy.
|
||||||
|
|
||||||
|
|
||||||
# Supported OS and compiler
|
# Supported OS and compiler
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ main() {
|
|||||||
else
|
else
|
||||||
echo "Build"
|
echo "Build"
|
||||||
cross build --target $TARGET
|
cross build --target $TARGET
|
||||||
cross build --target $TARGET --release
|
|
||||||
if [ ! -z $DISABLE_TESTS ]; then
|
if [ ! -z $DISABLE_TESTS ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ mod managed_directory;
|
|||||||
mod ram_directory;
|
mod ram_directory;
|
||||||
mod read_only_source;
|
mod read_only_source;
|
||||||
mod shared_vec_slice;
|
mod shared_vec_slice;
|
||||||
|
mod static_dictionnary;
|
||||||
|
|
||||||
/// Errors specific to the directory module.
|
/// Errors specific to the directory module.
|
||||||
pub mod error;
|
pub mod error;
|
||||||
@@ -21,6 +22,7 @@ use std::io::{BufWriter, Seek, Write};
|
|||||||
pub use self::directory::{Directory, DirectoryClone};
|
pub use self::directory::{Directory, DirectoryClone};
|
||||||
pub use self::ram_directory::RAMDirectory;
|
pub use self::ram_directory::RAMDirectory;
|
||||||
pub use self::read_only_source::ReadOnlySource;
|
pub use self::read_only_source::ReadOnlySource;
|
||||||
|
pub use self::static_dictionnary::StaticDirectory;
|
||||||
|
|
||||||
#[cfg(feature = "mmap")]
|
#[cfg(feature = "mmap")]
|
||||||
pub use self::mmap_directory::MmapDirectory;
|
pub use self::mmap_directory::MmapDirectory;
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ use fst::raw::MmapReadOnly;
|
|||||||
use stable_deref_trait::{CloneStableDeref, StableDeref};
|
use stable_deref_trait::{CloneStableDeref, StableDeref};
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
|
|
||||||
|
const EMPTY_SLICE: [u8; 0] = [];
|
||||||
|
|
||||||
/// Read object that represents files in tantivy.
|
/// Read object that represents files in tantivy.
|
||||||
///
|
///
|
||||||
/// These read objects are only in charge to deliver
|
/// These read objects are only in charge to deliver
|
||||||
@@ -17,6 +20,8 @@ pub enum ReadOnlySource {
|
|||||||
Mmap(MmapReadOnly),
|
Mmap(MmapReadOnly),
|
||||||
/// Wrapping a `Vec<u8>`
|
/// Wrapping a `Vec<u8>`
|
||||||
Anonymous(SharedVecSlice),
|
Anonymous(SharedVecSlice),
|
||||||
|
/// Wrapping a static slice
|
||||||
|
Static(&'static [u8])
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl StableDeref for ReadOnlySource {}
|
unsafe impl StableDeref for ReadOnlySource {}
|
||||||
@@ -33,7 +38,7 @@ impl Deref for ReadOnlySource {
|
|||||||
impl ReadOnlySource {
|
impl ReadOnlySource {
|
||||||
/// Creates an empty ReadOnlySource
|
/// Creates an empty ReadOnlySource
|
||||||
pub fn empty() -> ReadOnlySource {
|
pub fn empty() -> ReadOnlySource {
|
||||||
ReadOnlySource::Anonymous(SharedVecSlice::empty())
|
ReadOnlySource::Static(&EMPTY_SLICE)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the data underlying the ReadOnlySource object.
|
/// Returns the data underlying the ReadOnlySource object.
|
||||||
@@ -42,6 +47,7 @@ impl ReadOnlySource {
|
|||||||
#[cfg(feature = "mmap")]
|
#[cfg(feature = "mmap")]
|
||||||
ReadOnlySource::Mmap(ref mmap_read_only) => mmap_read_only.as_slice(),
|
ReadOnlySource::Mmap(ref mmap_read_only) => mmap_read_only.as_slice(),
|
||||||
ReadOnlySource::Anonymous(ref shared_vec) => shared_vec.as_slice(),
|
ReadOnlySource::Anonymous(ref shared_vec) => shared_vec.as_slice(),
|
||||||
|
ReadOnlySource::Static(data) => data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +85,9 @@ impl ReadOnlySource {
|
|||||||
ReadOnlySource::Anonymous(ref shared_vec) => {
|
ReadOnlySource::Anonymous(ref shared_vec) => {
|
||||||
ReadOnlySource::Anonymous(shared_vec.slice(from_offset, to_offset))
|
ReadOnlySource::Anonymous(shared_vec.slice(from_offset, to_offset))
|
||||||
}
|
}
|
||||||
|
ReadOnlySource::Static(data) => {
|
||||||
|
ReadOnlySource::Static(&data[from_offset..to_offset])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,3 +127,9 @@ impl From<Vec<u8>> for ReadOnlySource {
|
|||||||
ReadOnlySource::Anonymous(shared_data)
|
ReadOnlySource::Anonymous(shared_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<&'static [u8]> for ReadOnlySource {
|
||||||
|
fn from(data: &'static [u8]) -> ReadOnlySource {
|
||||||
|
ReadOnlySource::Static(data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ extern crate crossbeam;
|
|||||||
extern crate crossbeam_channel;
|
extern crate crossbeam_channel;
|
||||||
extern crate fnv;
|
extern crate fnv;
|
||||||
extern crate fst;
|
extern crate fst;
|
||||||
extern crate fst_regex;
|
|
||||||
extern crate futures;
|
extern crate futures;
|
||||||
extern crate futures_cpupool;
|
extern crate futures_cpupool;
|
||||||
extern crate htmlescape;
|
extern crate htmlescape;
|
||||||
|
|||||||
@@ -16,7 +16,10 @@ mod phrase_query;
|
|||||||
mod query;
|
mod query;
|
||||||
mod query_parser;
|
mod query_parser;
|
||||||
mod range_query;
|
mod range_query;
|
||||||
|
|
||||||
|
#[cfg(feature="regex_query")]
|
||||||
mod regex_query;
|
mod regex_query;
|
||||||
|
|
||||||
mod reqopt_scorer;
|
mod reqopt_scorer;
|
||||||
mod scorer;
|
mod scorer;
|
||||||
mod term_query;
|
mod term_query;
|
||||||
@@ -47,7 +50,10 @@ pub use self::query::Query;
|
|||||||
pub use self::query_parser::QueryParser;
|
pub use self::query_parser::QueryParser;
|
||||||
pub use self::query_parser::QueryParserError;
|
pub use self::query_parser::QueryParserError;
|
||||||
pub use self::range_query::RangeQuery;
|
pub use self::range_query::RangeQuery;
|
||||||
|
|
||||||
|
#[cfg(feature="regex_query")]
|
||||||
pub use self::regex_query::RegexQuery;
|
pub use self::regex_query::RegexQuery;
|
||||||
|
|
||||||
pub use self::reqopt_scorer::RequiredOptionalScorer;
|
pub use self::reqopt_scorer::RequiredOptionalScorer;
|
||||||
pub use self::scorer::ConstScorer;
|
pub use self::scorer::ConstScorer;
|
||||||
pub use self::scorer::Scorer;
|
pub use self::scorer::Scorer;
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
|
extern crate fst_regex;
|
||||||
|
|
||||||
use error::TantivyError;
|
use error::TantivyError;
|
||||||
use fst_regex::Regex;
|
use self::fst_regex::Regex;
|
||||||
use query::{AutomatonWeight, Query, Weight};
|
use query::{AutomatonWeight, Query, Weight};
|
||||||
use schema::Field;
|
use schema::Field;
|
||||||
use std::clone::Clone;
|
use std::clone::Clone;
|
||||||
|
|||||||
@@ -96,6 +96,9 @@ fn open_fst_index(source: ReadOnlySource) -> fst::Map {
|
|||||||
ReadOnlySource::Mmap(mmap_readonly) => {
|
ReadOnlySource::Mmap(mmap_readonly) => {
|
||||||
Fst::from_mmap(mmap_readonly).expect("FST data is corrupted")
|
Fst::from_mmap(mmap_readonly).expect("FST data is corrupted")
|
||||||
}
|
}
|
||||||
|
ReadOnlySource::Static(data) => {
|
||||||
|
Fst::from_static_slice(data).expect("FST data is corrupted")
|
||||||
|
}
|
||||||
};
|
};
|
||||||
fst::Map::from(fst)
|
fst::Map::from(fst)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user