diff options
author | Tor Brede Vekterli <vekterli@vespa.ai> | 2024-03-12 14:17:29 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@vespa.ai> | 2024-03-12 14:52:48 +0000 |
commit | b1c2f5e4548a0c468e280a32af6766b5c3710938 (patch) | |
tree | 2b3f09ea045fce6621dd21b260b6844309449c88 /LICENSE | |
parent | 89e2adfc2b268b33b9c25ef18bc32bfed9d5e838 (diff) |
Use attributes when evaluating selection expression on full documents
This addresses an unintended shortcoming in our handling of imported
fields, as these are exposed _only_ through attributes.
Document selection evaluation is automatically optimized in the backend
by pre-filtering documents that can be fully evaluated by exclusively
looking at attribute values (this goes for both selection matching
and mismatching). This is done by cloning the selection AST and
replacing all applicable field value nodes with corresponding attribute
references.
However, if a document _cannot_ be evaluated from attributes alone,
we fall back to reading it fully from the doc store, after which the
original selection is evaluated on it. This is the crux of the problem,
and prior to this commit an expression using both an imported field
and a non-attribute field would fail to be evaluated since the full
document evaluation would not have any knowledge of the attribute.
This commit makes it so that also the full document evaluation will
use a "patched" AST with all possible field references replaced with
attribute lookups. Since we reuse an existing patched AST that was not
otherwise used in this code path, there is no added overhead with this
approach.
Diffstat (limited to 'LICENSE')
0 files changed, 0 insertions, 0 deletions