You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kvrocks.apache.org by tw...@apache.org on 2024/04/05 23:40:34 UTC
(kvrocks) branch unstable updated: Skip noindex fields in indexer (#2223)
This is an automated email from the ASF dual-hosted git repository.
twice pushed a commit to branch unstable
in repository https://gitbox.apache.org/repos/asf/kvrocks.git
The following commit(s) were added to refs/heads/unstable by this push:
new 8ecccdd1 Skip noindex fields in indexer (#2223)
8ecccdd1 is described below
commit 8ecccdd148963080e5ed8c3a41f2c1aa0240fb6c
Author: Twice <tw...@gmail.com>
AuthorDate: Sat Apr 6 08:40:28 2024 +0900
Skip noindex fields in indexer (#2223)
Co-authored-by: hulk <hu...@gmail.com>
---
src/search/indexer.cc | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/search/indexer.cc b/src/search/indexer.cc
index bb4e88c1..df8f8eb3 100644
--- a/src/search/indexer.cc
+++ b/src/search/indexer.cc
@@ -96,6 +96,10 @@ StatusOr<IndexUpdater::FieldValues> IndexUpdater::Record(std::string_view key, c
FieldValues values;
for (const auto &[field, info] : fields) {
+ if (info->noindex) {
+ continue;
+ }
+
std::string value;
auto s = retriever.Retrieve(field, &value);
if (s.IsNotFound()) continue;
@@ -205,7 +209,11 @@ Status IndexUpdater::UpdateIndex(const std::string &field, std::string_view key,
Status IndexUpdater::Update(const FieldValues &original, std::string_view key, const std::string &ns) {
auto current = GET_OR_RET(Record(key, ns));
- for (const auto &[field, _] : fields) {
+ for (const auto &[field, info] : fields) {
+ if (info->noindex) {
+ continue;
+ }
+
std::string_view original_val, current_val;
if (auto it = original.find(field); it != original.end()) {