Skip to content

Commit

Permalink
Skip noindex fields in indexer (apache#2223)
Browse files Browse the repository at this point in the history
Co-authored-by: hulk <[email protected]>
  • Loading branch information
PragmaTwice and git-hulk authored Apr 5, 2024
1 parent d7b8450 commit 8ecccdd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/search/indexer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit 8ecccdd

Please sign in to comment.