Repository navigation
SOLR-18555: Add a handler for highlighting supplied text - #5183
Closed
nick-boss-tech wants to merge 12 commits into
Closed
nick-boss-tech wants to merge 12 commits into
nick-boss-tech wants to merge 12 commits into
Conversation
Contributor
Author
|
Still working on this and will resubmit soon, I am considering splitting it into 2 PRs since the first one can be narrow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖 (posted on behalf of Nick Shanin)
https://issues.apache.org/jira/browse/SOLR-18555
What happens today
HighlightComponentneeds a search result to create snippets. It requests aDocListbefore highlighting, so text in a request body alone is not enough. Base implementationWhat this change does
The new
/highlighthandler highlights one supplied text value without opening a searcher._defaultregisters it. POST accepts atext/plainbody; GET usesstream.body. Routes are/solr/{collection}/highlight,/api/c/{collection}/highlight, and/api/cores/{core}/highlight. Snippets appear underhighlighting.text.<field>. Handler and routes ConfigQuery parsing uses built-in Lucene syntax. Parser overrides, local parameters, and subqueries are disabled; wildcard fields are rejected.
_defaultuses_text_asdf.hl.maxAnalyzedCharsdefaults to 51,200, is capped at 1,048,576, and truncates longer input. The V2 spec allows GET and POST. This PR leaves the shared SolrJ method enum unchanged, and HTTP tests rejectQUERYon update and highlight routes. Query restrictions HTTP testsProof
Phase r1 passed at head
b99259cba3572cc08586b2456c78780c814a2bf7on 2026-10-19:HighlightRequestHandlerTestpassed 10 tests,HighlightRequestHandlerHttpTestpassed 2, and:solr:core:check -x testpassed. The base fails the new handler test with aLinkageErrorbecause the handler is absent. Phase r1 receiptAt current head
2c54781a6ea1c8a5d17b802fbc97fed18005aa2b, phase r2 was handed back aftertestGetStreamBodyAndV2Routesfailed: GET on/c/<core>/highlightreturned HTTP 500 in the non-cloud fixture because collection aliases require ZooKeeper there. The gate produced no proof for this head. Phase r2 result HTTP test at current headA choice to check
GET/POST and the
simpleencoder are the current defaults. Should the handler also accept body-orientedQUERY? That requires a shared SolrJ enum change and broader V2 method parsing, with authorization and client support to review. It remains outside this PR's scope.The
simpleencoder leaves text unescaped. Should this handler default tohtmlfor snippets rendered as HTML? That changes the response, while callers can already sethl.encoder=html. Encoder and guideLimits
Input past
hl.maxAnalyzedCharsis omitted without a signal,hl.flhas no separate field-count cap, and_query_rejection reportsundefined field _query_. These can be handled as focused follow-ups if maintainers want them. Input and field handlingChangelog: changelog/unreleased/SOLR-18555.yml
AI-generated description. Nick Shanin directed the work and takes responsibility for this contribution.