nick-boss-tech opened a new pull request, #5105: URL: https://github.com/apache/solr/pull/5105
🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)* https://issues.apache.org/jira/browse/SOLR-4540 ## What happens today **With a wildcard `hl.fl` and the FastVectorHighlighter, every matching field name goes through the FVH step, including fields the document does not have.** The reporter sees QTime above 10 seconds with `hl.fl=fulltext_*`, and about 30 ms with the explicit field name. For each field name, the FVH step looks up the field's fragments builder first ([DefaultSolrHighlighter.java L641](https://github.com/nick-boss-tech/solr/blob/180b6e8a7d3c23ac308a28d547f61816b5815f04/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java#L641)). An unknown builder name throws a 400 error ([L415-L421](https://github.com/nick-boss-tech/solr/blob/180b6e8a7d3c23ac308a28d547f61816b5815f04/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java#L415-L421)). So a field the document lacks can still fail the request. ## What this change does **A field the document lacks is skipped before the FVH step.** - When the document has no value for the field, the method returns null before it looks up the builder or runs FVH ([DefaultSolrHighlighter.java L636-L640](https://github.com/nick-boss-tech/solr/blob/180b6e8a7d3c23ac308a28d547f61816b5815f04/solr/core/src/java/org/apache/solr/highlight/DefaultSolrHighlighter.java#L636-L640)). The caller then tries the alternate field, as before. - The builder lookup now runs only for documents that have the field. Behavior change: before, a bad `fragmentsBuilder` name failed the request whether or not the document had the field. Now it fails only when a matching document has that field. ## Proof **The new test checks that a field the document lacks is skipped, even with an unknown builder set for it.** - `FastVectorHighlighterTest.testFieldAbsentFromDocIsSkipped` ([FastVectorHighlighterTest.java L94-L123](https://github.com/nick-boss-tech/solr/blob/180b6e8a7d3c23ac308a28d547f61816b5815f04/solr/core/src/test/org/apache/solr/highlight/FastVectorHighlighterTest.java#L94-L123)). The index has two documents. The query matches only the first, which lacks the other two fields. The request uses `hl.fl=tv_*` and sets an unknown builder for each of those two fields. - On the base code, this test fails: `FastVectorHighlighterTest.testFieldAbsentFromDocIsSkipped` fails at line 106 of the test. - A GitHub Actions run of `:solr:core` that covers FastVectorHighlighterTest completed successfully at this head. ## Limits **Covered: skipping absent fields on the FastVectorHighlighter path. Not covered: the timing in the ticket.** - No timing is measured in this change. The test checks the builder path, not QTime. - The default highlighter path is not changed. Changelog: `changelog/unreleased/SOLR-4540-fvh-skip-absent-fields.yml` ### AI assistance AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
