26 q2#631
Conversation
- create and use a map in XQuery - store a detailed string in HTML meta - create and use a Map in JS Cf. #580
- in api.xq, add header Accept to a parameter in the request map Cf. #579
…search - adjust search.xqm to use IDs for forms (→ eventListener) - search.xsl must support XML as returned from new API - search.js handles onSubmit of FTS search form Cf. #579
- use consistent wording - always use `result` when returning lists - streamline the definition and use
Cf. #579 Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Used for paging project-based search and for creating KWIC for a file. This way, KWIC does not require a new search if the session is still active. Cf. #579 Co-authored-by: Copilot <copilot@github.com>
Results are now grouped by their computed path (below tei:text). This means we can add info about structural elements to the HTML view. This can also be used to filter the results. This might be more efficient than creating fields beforehand. Ideally, we can drop most of the specialised idexes. Cf. #579 #566
In general, only tei:text is indexed, with head getting an additional index, and note handled separately Cf. #566
Co-authored-by: Copilot <copilot@github.com>
Includes improved creation of JSON output and additional error handling and documentation Co-authored-by: Copilot <copilot@github.com>
include changes to wdbDocument.loadContent this is now smarter and accepts an optional selector indicating what to extract from the response Cf. #579
as we modify the request to add a header, auth needs to be set explicitly or will not be executed, meanin all operations requiring auth will fail
Projects created inherit owner and rights from parent; by default, this should be world readable
The path in found in $model?filePathInfo?mainProject and this does not need repeating. Also, the ID of the project is what’s actually expected here
removed stale code and added an ID in HTML
It erroneously assumed `resources` to reside in the project collection even for sub-projects. - All calls to applySpecificXsl had to be changed to use the pathInfo map; this included calls to r2:returnResponse which itself calls wdb:applySpecificXls - `start.xqm` had to be adjusted as it expects an element but now gets the response map
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f3bb637c69
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Closes #628
As the API definition always starts with `/api/v2/`, Swagger’s base URL must not contain it. To keep things uniform, we always add `api/V2` in rest-common. Cf. #631 (comment)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfffb1283e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c3501d6798
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- use new API - keep option for reload Cf. #125
necessary to use different retsUrl in admin.js
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f6a83ba12
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| import module namespace kwic = "http://exist-db.org/xquery/kwic"; | ||
| import module namespace r2 = "https://github.com/dariok/wdbplus/rest2/common" at "rest-common.xqm"; | ||
| import module namespace wdb = "https://github.com/dariok/wdbplus/wdb" at "../modules/app.xqm"; | ||
| import module namespace wdbErr = "https://github.com/dariok/wdbplus/errors" at "error.xqm"; |
There was a problem hiding this comment.
Point the error import at the existing module
When the new search module is loaded for any /api/v2/search/... request, this relative import resolves within edoc/rest2/, but there is no edoc/rest2/error.xqm in the repo; the existing error module is edoc/modules/error.xqm (other modules import it as ../modules/error.xqm). As a result, importing search.xqm from api.xq can fail before either search endpoint runs.
Useful? React with 👍 / 👎.
| "self": concat($r2:base, 'search/ft/resource/', $request?parameters?id, '?q=', $query), | ||
| "from": $r2:base || 'resources/' || $request?parameters?id, |
There was a problem hiding this comment.
Include the API prefix in search result links
With config.xml now making $r2:base the app root (.../edoc) instead of the API root, concatenating bare search/... and resources/... here returns malformed links such as https://localhost/exist/apps/edocsearch/ft/resource/... and .../edocresources/... in successful file-search responses. Clients following the self or from URLs from /api/v2/search/ft/resource/{id} will be sent to non-existent paths; these should use the same $r2:urls prefixes used elsewhere in the commit.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4a8278c5b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| for $step in $sel[1]/* | ||
| return <step type="{ $step/@type }">{ $base || normalize-space($step) }</step> |
There was a problem hiding this comment.
Preserve legacy command text when building steps
Existing project metadata can still use the old command form, e.g. edoc/data/documentation/wdbmeta.xml has <command type="xsl">resources/xsl/tei-transcript.xsl</command>. This conversion only iterates child elements of the command, so that metadata produces a process with no meta:step; wdbProc:process then receives an empty sequence for a element(meta:step)+ parameter and resource views for those existing projects return 500 instead of rendering. Handle the text/@type form or migrate all bundled and existing metadata.
Useful? React with 👍 / 👎.
| ) else (), | ||
| r2:returnResponse($response, $request?headers?Accept, $pathInfo, "search") | ||
| ) | ||
| } catch wdbErr:wdb0000 | wdb0000 { |
There was a problem hiding this comment.
Catch missing search projects by local name
When /api/v2/search/ft/project/{ed} is called with an unknown project, wdbFiles:getFullPath throws QName('https://github.com/dariok/wdbErr', 'wdb0000'), but this catch only matches the wdbErr prefix declared to a different namespace or an unqualified name. The documented and tested 404 case therefore falls through to the generic catch and becomes a 500; use a wildcard catch such as *:wdb0000 like searchFile does.
Useful? React with 👍 / 👎.
| , $fileNameMod := $fileNameBase => replace(',', '') => replace(' ', '_') => replace('&', '-') | ||
| => replace('ä', 'ae') => replace('Ä', 'Ae') => replace('ö', 'oe') => replace('Ö', 'Oe') | ||
| => replace('ü', 'ue') => replace('Ü', 'Ue') => replace('ß', 'ss') |
There was a problem hiding this comment.
Compare uploads against the sanitized filename
This stores the resource and metadata under a normalized filename, but the conflict/idempotency checks in projects.xqm and resources.xqm still compare metadata paths against the original uploaded name. For a file named with a space, comma, or umlaut, the first upload records e.g. foo_bar.xml; a subsequent identical PUT with foo bar.xml no longer matches the existing path and is reported as a different-path conflict instead of 204/update.
Useful? React with 👍 / 👎.
| function ( $accumulator as node(), $step as element(meta:step) ) { | ||
| switch ( $step/@type ) | ||
| case "xsl" return wdbProc:processXSL($accumulator, doc(normalize-space($step))/*, $params) |
There was a problem hiding this comment.
Carry only transformed nodes between process steps
For commands with more than one meta:step, the first XSL step returns a map {status, content}, and fold-left passes that map as the next $accumulator, which is declared as node() and then handed to processXSL. Any multi-step process therefore fails with a type error and becomes a 500; the accumulator needs to be the transformed content node or the function needs to consistently accumulate a map.
Useful? React with 👍 / 👎.
No description provided.