diff options
author | Alex Saveliev <alexsav@google.com> | 2023-01-06 14:46:36 -0800 |
---|---|---|
committer | Alex Saveliev <alexsav@google.com> | 2023-01-06 14:46:36 -0800 |
commit | ec29b14d5a908748d6e0699df7c85842a95a7b3c (patch) | |
tree | 8e98a3ee5797ad466fc467a82de688a658566640 /icing/store | |
parent | 44f12ef84cba5a719d101c3aec9f4962352098d9 (diff) | |
download | icing-ec29b14d5a908748d6e0699df7c85842a95a7b3c.tar.gz |
Update icing from upstream
Descriptions:
======================================================================
Apply aggregation score to join result and create JoinProcessorTest
======================================================================
Create AggregationScorerTest
======================================================================
Add an EqualsTermMatchInfo matcher to simplify tests that interact with this struct.
======================================================================
Refactor the QueryVisitor to return QueryResults.
======================================================================
Simplify ScoreExpression to ConstantScoreExpression if its evaluation does not depend on a document
======================================================================
Use rvalue and std::move for DocumentStore methods
======================================================================
Downgrade log messages for NOT_FOUND errors in Delete calls.
======================================================================
[NumericSearch][Storage][3.1/x] Add metadata file declaration (Crcs, Info) for IntegerIndexStorage
======================================================================
[NumericSearch][Storage][3.0/x] Declare class IntegerIndexStorage
======================================================================
Cleanup Import from //tools/build_defs/objc
======================================================================
Cleanup LSC: Remove `portable_proto_library()` targets
======================================================================
Bug: 256022027
Bug: 208654892
Bug: 261474063
Bug: 246628980
Bug: 249829533
Bug: 263373214
Change-Id: Ib5ca7efffd575254e14a14d54a45f4efd1e8d6c9
Diffstat (limited to 'icing/store')
-rw-r--r-- | icing/store/document-store.cc | 11 | ||||
-rw-r--r-- | icing/store/document-store.h | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/icing/store/document-store.cc b/icing/store/document-store.cc index 3add705..9e79790 100644 --- a/icing/store/document-store.cc +++ b/icing/store/document-store.cc @@ -222,7 +222,7 @@ libtextclassifier3::StatusOr<DocumentId> DocumentStore::Put( DocumentProto&& document, int32_t num_tokens, PutDocumentStatsProto* put_document_stats) { document.mutable_internal_fields()->set_length_in_tokens(num_tokens); - return InternalPut(document, put_document_stats); + return InternalPut(std::move(document), put_document_stats); } DocumentStore::~DocumentStore() { @@ -840,7 +840,7 @@ libtextclassifier3::Status DocumentStore::UpdateHeader(const Crc32& checksum) { } libtextclassifier3::StatusOr<DocumentId> DocumentStore::InternalPut( - DocumentProto& document, PutDocumentStatsProto* put_document_stats) { + DocumentProto&& document, PutDocumentStatsProto* put_document_stats) { std::unique_ptr<Timer> put_timer = clock_.GetNewTimer(); ICING_RETURN_IF_ERROR(document_validator_.Validate(document)); @@ -1714,7 +1714,7 @@ DocumentStore::OptimizeInto(const std::string& new_directory, } // Guaranteed to have a document now. - DocumentProto document_to_keep = document_or.ValueOrDie(); + DocumentProto document_to_keep = std::move(document_or).ValueOrDie(); libtextclassifier3::StatusOr<DocumentId> new_document_id_or; if (document_to_keep.internal_fields().length_in_tokens() == 0) { @@ -1729,11 +1729,12 @@ DocumentStore::OptimizeInto(const std::string& new_directory, TokenizedDocument tokenized_document( std::move(tokenized_document_or).ValueOrDie()); new_document_id_or = new_doc_store->Put( - document_to_keep, tokenized_document.num_string_tokens()); + std::move(document_to_keep), tokenized_document.num_string_tokens()); } else { // TODO(b/144458732): Implement a more robust version of // TC_ASSIGN_OR_RETURN that can support error logging. - new_document_id_or = new_doc_store->InternalPut(document_to_keep); + new_document_id_or = + new_doc_store->InternalPut(std::move(document_to_keep)); } if (!new_document_id_or.ok()) { ICING_LOG(ERROR) << new_document_id_or.status().error_message() diff --git a/icing/store/document-store.h b/icing/store/document-store.h index 58977bf..bda351d 100644 --- a/icing/store/document-store.h +++ b/icing/store/document-store.h @@ -628,7 +628,7 @@ class DocumentStore { libtextclassifier3::Status UpdateHeader(const Crc32& checksum); libtextclassifier3::StatusOr<DocumentId> InternalPut( - DocumentProto& document, + DocumentProto&& document, PutDocumentStatsProto* put_document_stats = nullptr); // Helper function to do batch deletes. Documents with the given |