pub fn run(&self, user_operations: Vec<UserOperation>) -> Opstamp {
        let count = user_operations.len() as u64;
        if count == 0 {
            return self.stamper.stamp();
        }
        let (batch_opstamp, stamps) = self.get_batch_opstamps(count);

        let mut adds = OperationGroup::default();

        for (user_op, opstamp) in user_operations.into_iter().zip(stamps) {
            match user_op {
                UserOperation::Delete(term) => {
                    let delete_operation = DeleteOperation { opstamp, term };
                    self.delete_queue.push(delete_operation);
                }
                UserOperation::Add(document) => {
                    let add_operation = AddOperation { opstamp, document };
                    adds.push(add_operation);
                }
            }
        }
        let send_result = self.operation_sender.send(adds);
        if let Err(e) = send_result {
            panic!("Failed to index document. Sending to indexing channel failed. This probably means all of the indexing threads have panicked. {:?}", e);
        };

        batch_opstamp
    }
/// Runs a group of document operations ensuring that the operations are
/// assigned contigous u64 opstamps and that add operations of the same
/// group are flushed into the same segment.
///
/// If the indexing pipeline is full, this call may block.
///
/// Each operation of the given `user_operations` will receive an in-order,
/// contiguous u64 opstamp. The entire batch itself is also given an
/// opstamp that is 1 greater than the last given operation. This
/// `batch_opstamp` is the return value of `run`. An empty group of
/// `user_operations`, an empty `Vec<UserOperation>`, still receives
/// a valid opstamp even though no changes were _actually_ made to the index.
///
/// Like adds and deletes (see `IndexWriter.add_document` and
/// `IndexWriter.delete_term`), the changes made by calling `run` will be
/// visible to readers only after calling `commit()`.
Runs a group of document operations ensuring that the operations are
assigned contigous u64 opstamps and that add operations of the same
group are flushed into the same segment.

If the indexing pipeline is full, this call may block.

Each operation of the given `user_operations` will receive an in-order,
contiguous u64 opstamp. The entire batch itself is also given an
opstamp that is 1 greater than the last given operation. This
`batch_opstamp` is the return value of `run`. An empty group of
`user_operations`, an empty `Vec`, still receives
a valid opstamp even though no changes were _actually_ made to the index.


Runs a group of document operations ensuring that the operations are assigned contigous u64 opstamps and that add operations of the same group are flushed into the same segment . If the indexing pipeline is full this call may block . Each operation of the given ` user_operations ` will receive an in - order contiguous u64 opstamp . The entire batch itself is also given an opstamp that is 1 greater than the last given operation . This ` batch_opstamp ` is the return value of ` run ` . An empty group of ` user_operations ` an empty ` Vec ` still receives a valid opstamp even though no changes were _actually_ made to the index .
pub fn run(&self, user_operations: Vec<UserOperation>) -> Opstamp {
        let count = user_operations.len() as u64;
        if count == 0 {
            return self.stamper.stamp();
        }
        let (batch_opstamp, stamps) = self.get_batch_opstamps(count);
        let mut adds = OperationGroup::default();
        for (user_op, opstamp) in user_operations.into_iter().zip(stamps) {
            match user_op {
                UserOperation::Delete(term) => {
                    let delete_operation = DeleteOperation { opstamp, term };
                    self.delete_queue.push(delete_operation);
                }
                UserOperation::Add(document) => {
                    let add_operation = AddOperation { opstamp, document };
                    adds.push(add_operation);
                }
            }
        }
        let send_result = self.operation_sender.send(adds);
        if let Err(e) = send_result {
            panic!("Failed to index document. Sending to indexing channel failed. This probably means all of the indexing threads have panicked. {:?}", e);
        };
        batch_opstamp
    }
pub fn run ( & self , user_operations : Vec < UserOperation > ) -> Opstamp { let count = user_operations . len ( ) as u64 ; if count == 0 { return self . stamper . stamp ( ) ; } let ( batch_opstamp , stamps ) = self . get_batch_opstamps ( count ) ; let mut adds = OperationGroup :: default ( ) ; for ( user_op , opstamp ) in user_operations . into_iter ( ) . zip ( stamps ) { match user_op { UserOperation :: Delete ( term ) => { let delete_operation = DeleteOperation { opstamp , term } ; self . delete_queue . push ( delete_operation ) ; } UserOperation :: Add ( document ) => { let add_operation = AddOperation { opstamp , document } ; adds . push ( add_operation ) ; } } } let send_result = self . operation_sender . send ( adds ) ; if let Err ( e ) = send_result { panic ! ( " " e ) ; } ; batch_opstamp }
Runs a group of document operations ensuring that the operations are
assigned contigous u64 opstamps and that add operations of the same
group are flushed into the same segment.
Runs a group of document operations ensuring that the operations are assigned contigous u64 opstamps and that add operations of the same group are flushed into the same segment .
&self
user_operations
Vec<UserOperation>
&self
user_operations
Vec<UserOperation>