Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Commit a123c0c

Browse files
committed
Add comment explaining array filter semantics
Tantivy indexes array elements as individual terms with no way to match on array structure. Document why IN (match any) is used for multi-element arrays.
1 parent bcae3dd commit a123c0c

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/modifyQuery.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ export function addAddHocFilter(query: string, filter: AdHocVariableFilter): str
3333

3434
const equalityFilters = ['=', '!='];
3535
if (equalityFilters.includes(filter.operator)) {
36+
// Grafana stringifies array values (e.g. ["paperclip","stapler"]) before
37+
// passing them as filter values. Tantivy indexes array elements as
38+
// individual terms — there's no way to match on array length, order, or
39+
// exact composition. For multi-element arrays we use IN (match any),
40+
// which is the most useful behavior for log exploration filters.
3641
const arrayElements = tryParseJsonArray(filter.value);
3742
if (arrayElements !== null) {
3843
if (arrayElements.length === 0) {

0 commit comments

Comments
 (0)