Skip to content

[test] Cover boost-config + facet drill-down in the ft:highlight regression#6486

Merged
line-o merged 1 commit into
eXist-db:developfrom
joewiz:test/facet-drilldown-highlight-boost
Jun 17, 2026
Merged

[test] Cover boost-config + facet drill-down in the ft:highlight regression#6486
line-o merged 1 commit into
eXist-db:developfrom
joewiz:test/facet-drilldown-highlight-boost

Conversation

@joewiz

@joewiz joewiz commented Jun 16, 2026

Copy link
Copy Markdown
Member

[This PR was co-authored with Claude Code. -Joe]

Summary

Test-only follow-up to #6454 (merged), which fixed ft:highlight-field-matches under facet drill-down. That fix had two parts in LuceneUtil.extractTerms: extractTermsFromDrillDown now uses DrillDownQuery.getBaseQuery() instead of rewriting, and a new FunctionScoreQuery case unwraps getWrappedQuery() and recurses.

The second part exists specifically for the boost-config + facet combination: when an index carries a boost, the query stored on each match is FunctionScoreQuery(DrillDownQuery(content)), and DrillDownQuery.visit() is an opaque visitLeaf — so without unwrapping the FunctionScoreQuery to reach the drill-down's base query, highlight extraction marks nothing. That path shipped in #6454 without a dedicated test; this PR adds one.

What changed

  • extensions/indexes/lucene/src/test/xquery/lucene/facet-drilldown-highlight.xqm — adds a second, boost-configured collection (boost="2.0" on the para field) and two assertions against it:
    • a faceted query still highlights under boost;
    • the highlighted term is the queried term under boost + drill-down.

No production code changes — the fix is already in develop via #6454.

Test plan

  • Full lucene XQuery suite green: LuceneTests 668 tests, 0 failures, 0 errors (36 pre-existing skips).
  • Confirmed the two new assertions fail when the FunctionScoreQuery unwrap is removed and pass with it — i.e. they genuinely guard that path, not just the already-covered plain-facet path.

…ion test

Follow-up to eXist-db#6454, which fixed ft:highlight-field-matches under facet
drill-down (DrillDownQuery.getBaseQuery() plus a FunctionScoreQuery unwrap in
LuceneUtil.extractTerms). The FunctionScoreQuery branch specifically handles
the boost-config + facet combination, where the query stored on the match is
FunctionScoreQuery(DrillDownQuery(content)) and DrillDownQuery.visit() is an
opaque leaf. That path shipped without a test.

Adds a second, boost-configured collection (boost="2.0" on the para field) to
facet-drilldown-highlight.xqm plus two assertions: a faceted query still
highlights, and the highlighted term is the queried term. Confirmed these fail
without the FunctionScoreQuery unwrap and pass with it. Full lucene XQuery
suite green (668 tests, 0 failures).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@joewiz joewiz requested a review from a team as a code owner June 16, 2026 21:17
@duncdrum duncdrum added the Lucene issue is related to Lucene or its integration label Jun 17, 2026
@duncdrum duncdrum requested a review from a team June 17, 2026 07:47
@line-o line-o merged commit f6e81e0 into eXist-db:develop Jun 17, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Lucene issue is related to Lucene or its integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants