pub struct StructInfo {
pub struct_name: String,
pub fields: Vec<FieldInfo>,
}Fields§
§struct_name: String§fields: Vec<FieldInfo>Implementations§
Source§impl StructInfo
impl StructInfo
pub fn new(name: String) -> StructInfo
pub fn add_field(&mut self, field: FieldInfo)
Sourcepub fn generate_schema(&self) -> Schema
pub fn generate_schema(&self) -> Schema
Examples found in repository?
examples/index_and_term_delete.rs (line 26)
8fn main() {
9 let path = "/home/salman/text-search-test";
10 let _ = fs::remove_dir_all(&path);
11 let _ = fs::create_dir(&path);
12 let mut indexer = Indexer::<Book>::new(Path::new(path));
13 let books = Book::get_sample_books();
14 for book in &books {
15 indexer.index(book.clone());
16 }
17 indexer.commit();
18
19 println!("Before deleting");
20 let regex_search_result = indexer.hybrid_search(HashMap::new(), "name", "Rust", 10);
21 for book in regex_search_result {
22 println!("{:?}", book);
23 }
24
25 let field = Book::get_struct_info()
26 .generate_schema()
27 .get_field("author")
28 .unwrap();
29
30 let term = Term::from_field_text(field, "Steve Klabnik and Carol Nichols");
31 indexer.delete_using_term(term);
32 indexer.commit();
33
34 println!("After deleting");
35 let regex_search_result = indexer.hybrid_search(HashMap::new(), "name", "Rust", 10);
36 for book in regex_search_result {
37 println!("{:?}", book);
38 }
39}pub fn get_id_field(&self) -> &FieldInfo
Auto Trait Implementations§
impl Freeze for StructInfo
impl RefUnwindSafe for StructInfo
impl Send for StructInfo
impl Sync for StructInfo
impl Unpin for StructInfo
impl UnsafeUnpin for StructInfo
impl UnwindSafe for StructInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more