Skip to content

Commit

Permalink
debug problematic keys
Browse files Browse the repository at this point in the history
  • Loading branch information
m5r committed Nov 20, 2024
1 parent 549b7b1 commit 4686960
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ function (doc) {
return;
}

const fieldNameRegex = /^\$?[a-zA-Z][a-zA-Z0-9_]*$/g
if (!fieldNameRegex.test(key)) {
log(`key "${key}" doesn't pass regex - "${doc.id}"`);
}

key = key.toLowerCase();
if (skip.indexOf(key) !== -1 || /_date$/.test(key)) {
return;
}

if (typeof value === 'string') {
toIndex += ' ' + value;
index('text', key, value, { store: true });
}
});

Expand Down

0 comments on commit 4686960

Please sign in to comment.