Skip to content

Add calculated predicate search plumbing - #6721

Draft
Mallets wants to merge 1 commit into
mainfrom
mallets/calculated-predicate-plumbing
Draft

Add calculated predicate search plumbing#6721
Mallets wants to merge 1 commit into
mainfrom
mallets/calculated-predicate-plumbing

Conversation

@Mallets

@Mallets Mallets commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add calculated predicate expressions to the search protocol and lower them into Tantivy leaf queries
  • warm predicate fast fields before synchronous search execution
  • disable metadata-only count shortcuts when a calculated predicate must be evaluated
  • update the Tantivy revision and adapt Quickwit to its custom field and segment component APIs

Test plan

  • cargo test -p quickwit-search calculated_predicate --lib
  • cargo test -p quickwit-search test_metadata_count_request_with_calculated_predicate --lib
  • cargo +nightly fmt --all
  • exercise a calculated predicate through the full remote-storage root-to-leaf search path

Expose calculated predicates through the search protocol and evaluate them safely against warmed Tantivy fast fields.
SegmentComponent::Delete,
];
let mut files = HashSet::new();
for segment_meta in index_meta.segments {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understadn what this is about?

You were hit by the new tantivy plugin change that the list_files method does not exist anymore? I think there is another utility to do that computation no?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like we DO need to modify tantivy.

SegmentComponent::Postings,
SegmentComponent::Positions,
SegmentComponent::Terms,
SegmentComponent::Store,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above.

BYTES = 7;
IP_ADDR = 8;
JSON = 9;
CUSTOM = 10;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this in protobuf land? Shouldn't we just return an error or panic before?

int32 priority = 21;

// Predicate expression evaluated by Tantivy against fast fields on each leaf.
optional CalculatedPredicate calculated_predicate = 22;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how this can make sense with the existing query_ast.

Comment thread quickwit/Cargo.lock
checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b"
dependencies = [
"gimli",
"gimli 0.32.3",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you go through the added dependencies and double check if they are justfiied or not pulled at all?

Comment thread quickwit/Cargo.lock
[[package]]
name = "cranelift-assembler-x64-meta"
version = "0.134.4"
source = "registry+https://github.com/rust-lang/crates.io-index"

@fulmicoton fulmicoton Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that one is likely unnecessary for instance. This is not a change to do in quicwkit, but in tantivy but still very important to follow up.

Comment thread quickwit/Cargo.lock
]

[[package]]
name = "wasmtime-internal-core"

@fulmicoton fulmicoton Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im surprised we need that. do we need to disable things in cranelift? (again, in tantivy)

}
}

message CalculatedPredicateFuncCall {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query ast is expressed using json today. I don't think it we need to change this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants