[feature] Search: discover searchable fields via /api/search/fields (Search-in picker)#37
Merged
Merged
Conversation
…Search-in picker)
Consume existdb-openapi's GET /api/search/fields?scope=… to populate a "Search in"
picker in the Search dialog. The endpoint returns the fields/facets/vectors visible
to the caller (field-level security filters the list), each with its kind, source
elements, type, analyzer, and returnable flag.
- ExistClient.searchFields(scope) -> SearchFields{scope,user,total,fields[]} with a
SearchFieldInfo record. The server reports `analyzer` as either a string or an
array; it's normalized to a list (covered by a unit test, with facet/field/vector
and both analyzer shapes via the mock).
- SearchDialog: a "Search in:" combo populated per server (off-EDT), sorted
field→facet→vector, with the contract shown as a tooltip and an FLS hint ("N
visible to <user>"). Older servers without the endpoint just show "All fields".
Discovery only for now: per-field *querying* needs eXist-db/exist#6455 (today
/api/search runs the default field), so the selection is a preview — the combo's
tooltip says so. Wiring the selection into the query is the follow-up once #6455
lands.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… buttons A WEST-placed status label takes its full preferred width, so a long message — e.g. a 500's raw JSON body — overflowed and overlapped the Cancel/Open buttons. Move the status to CENTER (it gets only the space left after the buttons and clips) and keep the full error text on hover. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
[This PR was co-authored with Claude Code. -Joe]
Summary
Adds a "Search in:" picker to the Search dialog, populated from existdb-openapi's
GET /api/search/fields?scope=/db. The endpoint lists the searchable fields / facets / vectors visible to the calling user (field-level security filters the list), each with itskind, sourceelements,type,analyzer, andreturnableflag.This is the discovery half of field-aware search. Per-field querying needs eXist-db/exist#6455 (today
/api/searchruns the defaultsite-contentfield), so the picker is a preview for now — selecting a field doesn't yet scope the query. Wiring the selection in is the follow-up once #6455 lands.What changed
ExistClient.searchFields(scope)→SearchFields{scope, user, total, fields[]}with aSearchFieldInforecord (field,kind,elements,type,analyzers,returnable). The server reportsanalyzeras either a string or an array — normalized to a list. Unit-tested via the mock (facet + string-analyzer field + array-analyzer field + vector).SearchDialog— a "Search in:" combo populated per selected server (off-EDT), sorted field → facet → vector, with the field's contract as a tooltip and an FLS hint ("N visible to <user>"). Re-discovers when the server changes. Older servers without the endpoint just show "All fields".Test plan
mvn testgreen (incl. the new string-vs-array analyzer parse test); Codacy PMD clean.ft:fields, e.g. the PoC bed:19109added as a connection): open Search → the "Search in:" combo lists the fields; hover an item to see elements/type/analyzer; the hint shows the count + resolved user.adminthe list is larger than asguest(12 vs 7 on the PoC bed)./api/search/fields, the combo just shows "All fields" (no error).Notes
PoC caveat:
ft:fields(eXist-db/exist#6459) isn't in a released eXist; the discovery endpoint runs on the:19109PoC bed./api/searchitself currently 500s on that bed, which is why this PR is discovery-only and doesn't touch the query path.