aboutsummaryrefslogtreecommitdiff
path: root/icing/index/main/posting-list-hit-serializer.h
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-07 00:06:15 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-12-07 00:06:15 +0000
commitc2be20616650e2f8ccb1d592654c08d6fda315ca (patch)
tree9892cbbd0fb247ce252a38f258e33741ca025a45 /icing/index/main/posting-list-hit-serializer.h
parent6d51031f6fac465f09e95982b19c4f86c88ee2fa (diff)
parentad9e08ff59020f5b52410dc093061d8ef715a781 (diff)
downloadicing-android-14.0.0_r36.tar.gz
Change-Id: Ia93a92877933208d4b5ed5f6473564134928dc04
Diffstat (limited to 'icing/index/main/posting-list-hit-serializer.h')
-rw-r--r--icing/index/main/posting-list-hit-serializer.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/icing/index/main/posting-list-hit-serializer.h b/icing/index/main/posting-list-hit-serializer.h
index 975b05a..2986d9c 100644
--- a/icing/index/main/posting-list-hit-serializer.h
+++ b/icing/index/main/posting-list-hit-serializer.h
@@ -23,6 +23,7 @@
#include "icing/file/posting_list/posting-list-common.h"
#include "icing/file/posting_list/posting-list-used.h"
#include "icing/index/hit/hit.h"
+#include "icing/util/status-macros.h"
namespace icing {
namespace lib {
@@ -72,8 +73,9 @@ class PostingListHitSerializer : public PostingListSerializer {
// keep_prepended is true, whatever could be prepended is kept, otherwise the
// posting list is left in its original state.
template <class T, Hit (*GetHit)(const T&)>
- uint32_t PrependHitArray(PostingListUsed* posting_list_used, const T* array,
- uint32_t num_hits, bool keep_prepended) const;
+ libtextclassifier3::StatusOr<uint32_t> PrependHitArray(
+ PostingListUsed* posting_list_used, const T* array, uint32_t num_hits,
+ bool keep_prepended) const;
// Retrieves the hits stored in the posting list.
//
@@ -312,9 +314,10 @@ class PostingListHitSerializer : public PostingListSerializer {
// Inlined functions. Implementation details below. Avert eyes!
template <class T, Hit (*GetHit)(const T&)>
-uint32_t PostingListHitSerializer::PrependHitArray(
- PostingListUsed* posting_list_used, const T* array, uint32_t num_hits,
- bool keep_prepended) const {
+libtextclassifier3::StatusOr<uint32_t>
+PostingListHitSerializer::PrependHitArray(PostingListUsed* posting_list_used,
+ const T* array, uint32_t num_hits,
+ bool keep_prepended) const {
if (!IsPostingListValid(posting_list_used)) {
return 0;
}
@@ -331,7 +334,7 @@ uint32_t PostingListHitSerializer::PrependHitArray(
// before. PopFrontHits guarantees that it will remove all 'i' hits so long
// as there are at least 'i' hits in the posting list, which we know there
// are.
- PopFrontHits(posting_list_used, /*num_hits=*/i);
+ ICING_RETURN_IF_ERROR(PopFrontHits(posting_list_used, /*num_hits=*/i));
}
return i;
}