[−][src]Struct tantivy_fst::raw::OpBuilder
A builder for collecting fst streams on which to perform set operations on the keys of fsts.
Set operations include intersection, union, difference and symmetric difference. The result of each set operation is itself a stream that emits pairs of keys and a sequence of each occurrence of that key in the participating streams. This information allows one to perform set operations on fsts and customize how conflicting output values are handled.
All set operations work efficiently on an arbitrary number of streams with memory proportional to the number of streams.
The algorithmic complexity of all set operations is O(n1 + n2 + n3 + ...)
where n1, n2, n3, ...
correspond to the number of elements in each
stream.
The 'f
lifetime parameter refers to the lifetime of the underlying set.
Methods
impl<'f> OpBuilder<'f>
[src]
pub fn add<I, S>(self, stream: I) -> Self where
I: for<'a> IntoStreamer<'a, Into = S, Item = (&'a [u8], Output)>,
S: 'f + for<'a> Streamer<'a, Item = (&'a [u8], Output)>,
[src]
I: for<'a> IntoStreamer<'a, Into = S, Item = (&'a [u8], Output)>,
S: 'f + for<'a> Streamer<'a, Item = (&'a [u8], Output)>,
Add a stream to this set operation.
This is useful for a chaining style pattern, e.g.,
builder.add(stream1).add(stream2).union()
.
The stream must emit a lexicographically ordered sequence of key-value pairs.
pub fn push<I, S>(&mut self, stream: I) where
I: for<'a> IntoStreamer<'a, Into = S, Item = (&'a [u8], Output)>,
S: 'f + for<'a> Streamer<'a, Item = (&'a [u8], Output)>,
[src]
I: for<'a> IntoStreamer<'a, Into = S, Item = (&'a [u8], Output)>,
S: 'f + for<'a> Streamer<'a, Item = (&'a [u8], Output)>,
Add a stream to this set operation.
The stream must emit a lexicographically ordered sequence of key-value pairs.
pub fn union(self) -> Union<'f>
[src]
Performs a union operation on all streams that have been added.
Note that this returns a stream of (&[u8], &[IndexedValue])
. The
first element of the tuple is the byte string key. The second element
of the tuple is a list of all occurrences of that key in participating
streams. The IndexedValue
contains an index and the value associated
with that key in that stream. The index uniquely identifies each
stream, which is an integer that is auto-incremented when a stream
is added to this operation (starting at 0
).
pub fn intersection(self) -> Intersection<'f>
[src]
Performs an intersection operation on all streams that have been added.
Note that this returns a stream of (&[u8], &[IndexedValue])
. The
first element of the tuple is the byte string key. The second element
of the tuple is a list of all occurrences of that key in participating
streams. The IndexedValue
contains an index and the value associated
with that key in that stream. The index uniquely identifies each
stream, which is an integer that is auto-incremented when a stream
is added to this operation (starting at 0
).
pub fn difference(self) -> Difference<'f>
[src]
Performs a difference operation with respect to the first stream added. That is, this returns a stream of all elements in the first stream that don't exist in any other stream that has been added.
Note that this returns a stream of (&[u8], &[IndexedValue])
. The
first element of the tuple is the byte string key. The second element
of the tuple is a list of all occurrences of that key in participating
streams. The IndexedValue
contains an index and the value associated
with that key in that stream. The index uniquely identifies each
stream, which is an integer that is auto-incremented when a stream
is added to this operation (starting at 0
).
pub fn symmetric_difference(self) -> SymmetricDifference<'f>
[src]
Performs a symmetric difference operation on all of the streams that have been added.
When there are only two streams, then the keys returned correspond to keys that are in either stream but not in both streams.
More generally, for any number of streams, keys that occur in an odd number of streams are returned.
Note that this returns a stream of (&[u8], &[IndexedValue])
. The
first element of the tuple is the byte string key. The second element
of the tuple is a list of all occurrences of that key in participating
streams. The IndexedValue
contains an index and the value associated
with that key in that stream. The index uniquely identifies each
stream, which is an integer that is auto-incremented when a stream
is added to this operation (starting at 0
).
Trait Implementations
impl<'f> Default for OpBuilder<'f>
[src]
impl<'f, I, S> Extend<I> for OpBuilder<'f> where
I: for<'a> IntoStreamer<'a, Into = S, Item = (&'a [u8], Output)>,
S: 'f + for<'a> Streamer<'a, Item = (&'a [u8], Output)>,
[src]
I: for<'a> IntoStreamer<'a, Into = S, Item = (&'a [u8], Output)>,
S: 'f + for<'a> Streamer<'a, Item = (&'a [u8], Output)>,
fn extend<T>(&mut self, it: T) where
T: IntoIterator<Item = I>,
[src]
T: IntoIterator<Item = I>,
impl<'f, I, S> FromIterator<I> for OpBuilder<'f> where
I: for<'a> IntoStreamer<'a, Into = S, Item = (&'a [u8], Output)>,
S: 'f + for<'a> Streamer<'a, Item = (&'a [u8], Output)>,
[src]
I: for<'a> IntoStreamer<'a, Into = S, Item = (&'a [u8], Output)>,
S: 'f + for<'a> Streamer<'a, Item = (&'a [u8], Output)>,
fn from_iter<T>(it: T) -> Self where
T: IntoIterator<Item = I>,
[src]
T: IntoIterator<Item = I>,
Auto Trait Implementations
impl<'f> !RefUnwindSafe for OpBuilder<'f>
impl<'f> !Send for OpBuilder<'f>
impl<'f> !Sync for OpBuilder<'f>
impl<'f> Unpin for OpBuilder<'f>
impl<'f> !UnwindSafe for OpBuilder<'f>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,