You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by "tballison (via GitHub)" <gi...@apache.org> on 2026/05/28 13:20:52 UTC
[PR] TIKA-4743 improve search and navigation on site [tika]
tballison opened a new pull request, #2845:
URL: https://github.com/apache/tika/pull/2845
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
Thanks for your contribution to [Apache Tika](https://tika.apache.org/)! Your help is appreciated!
Before opening the pull request, please verify that
* there is an open issue on the [Tika issue tracker](https://issues.apache.org/jira/projects/TIKA) which describes the problem or the improvement. We cannot accept pull requests without an issue because the change wouldn't be listed in the release notes.
* the issue ID (`TIKA-XXXX`)
- is referenced in the title of the pull request
- and placed in front of your commit messages surrounded by square brackets (`[TIKA-XXXX] Issue or pull request title`)
* commits are squashed into a single one (or few commits for larger changes)
* Tika is successfully built and unit tests pass by running `./mvnw clean test`
* there should be no conflicts when merging the pull request branch into the *recent* `main` branch. If there are conflicts, please try to rebase the pull request branch on top of a freshly pulled `main` branch
* if you add new module that downstream users will depend upon add it to relevant group in `tika-bom/pom.xml`.
We will be able to faster integrate your pull request if these conditions are met. If you have any questions how to fix your problem or about using Tika in general, please sign up for the [Tika mailing list](http://tika.apache.org/mail-lists.html). Thanks!
--
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: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4743 improve search and navigation on site [tika]
Posted by "THausherr (via GitHub)" <gi...@apache.org>.
THausherr commented on code in PR #2845:
URL: https://github.com/apache/tika/pull/2845#discussion_r3322089125
##########
docs/publish-docs.sh:
##########
@@ -40,12 +40,16 @@ mkdir -p "${DOCS_DIR}"
# Strip the 'tika/' component dir prefix so URLs are /docs/X.Y.Z/...
cp -r target/site/tika/* "${DOCS_DIR}/"
-# UI assets one level above docs/, since HTML uses ../../_/ relative paths
-cp -r target/site/_/ "${PUBLISH_DIR}/_/"
+# UI assets one level above docs/, since HTML uses ../../_/ relative paths.
+# Replace wholesale: cp -r into an existing directory nests source as a
+# subdirectory (publish/_/_/), so remove first to keep the layout flat.
+rm -rf "${PUBLISH_DIR}/_"
+cp -r target/site/_ "${PUBLISH_DIR}/_"
Review Comment:
😱
--
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: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4743 improve search and navigation on site [tika]
Posted by "tballison (via GitHub)" <gi...@apache.org>.
tballison commented on code in PR #2845:
URL: https://github.com/apache/tika/pull/2845#discussion_r3324507680
##########
docs/publish-docs.sh:
##########
@@ -40,12 +40,16 @@ mkdir -p "${DOCS_DIR}"
# Strip the 'tika/' component dir prefix so URLs are /docs/X.Y.Z/...
cp -r target/site/tika/* "${DOCS_DIR}/"
-# UI assets one level above docs/, since HTML uses ../../_/ relative paths
-cp -r target/site/_/ "${PUBLISH_DIR}/_/"
+# UI assets one level above docs/, since HTML uses ../../_/ relative paths.
+# Replace wholesale: cp -r into an existing directory nests source as a
+# subdirectory (publish/_/_/), so remove first to keep the layout flat.
+rm -rf "${PUBLISH_DIR}/_"
+cp -r target/site/_ "${PUBLISH_DIR}/_"
Review Comment:
Who doesn't want surprise spring cleaning every once in a while?
But seriously, I think this was more :unamused: than :scream: I've added more guards, and I'm grateful for the comment.
--
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: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4743 improve search and navigation on site [tika]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2845:
URL: https://github.com/apache/tika/pull/2845#discussion_r3319659877
##########
docs/publish-docs.sh:
##########
@@ -40,12 +40,16 @@ mkdir -p "${DOCS_DIR}"
# Strip the 'tika/' component dir prefix so URLs are /docs/X.Y.Z/...
cp -r target/site/tika/* "${DOCS_DIR}/"
-# UI assets one level above docs/, since HTML uses ../../_/ relative paths
-cp -r target/site/_/ "${PUBLISH_DIR}/_/"
+# UI assets one level above docs/, since HTML uses ../../_/ relative paths.
+# Replace wholesale: cp -r into an existing directory nests source as a
+# subdirectory (publish/_/_/), so remove first to keep the layout flat.
+rm -rf "${PUBLISH_DIR}/_"
+cp -r target/site/_ "${PUBLISH_DIR}/_"
Review Comment:
`rm -rf "${PUBLISH_DIR}/_"` makes the script more dangerous if `PUBLISH_DIR` is accidentally set incorrectly (e.g., `/` or an unexpected checkout). Consider adding a safety check (e.g., verify `PUBLISH_DIR` exists and looks like a tika-site `publish/` dir) before removing, or refuse to run when `PUBLISH_DIR` is too short / equals `/`.
##########
docs/supplemental-ui/partials/header-content.hbs:
##########
@@ -5,22 +5,21 @@
<img src="{{{uiRootPath}}}/img/ASF_Tika-colour.svg" alt="Apache Tika" style="height: 2rem; margin-right: 0.5rem; background: white; padding: 2px 4px; border-radius: 3px;">
{{site.title}}
</a>
- <button class="navbar-burger" aria-label="Toggle navigation" data-target="topbar-nav">
+ {{#if env.SITE_SEARCH_PROVIDER}}
+ <div class="navbar-item search hide-for-print">
+ <div id="search-field" class="field">
+ <input id="search-input" type="text" placeholder="Search the docs"{{#if page.home}} autofocus{{/if}}>
Review Comment:
The new search input is missing an accessible label. Placeholders aren’t a substitute for labels, so screen readers may announce this as an unlabeled edit field. Consider adding an associated <label> (visually hidden if needed) and/or an `aria-label` (and optionally `type="search"` / `role="search"`).
--
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: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4743 improve search and navigation on site [tika]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #2845:
URL: https://github.com/apache/tika/pull/2845#discussion_r3324845000
##########
docs/publish-docs.sh:
##########
@@ -28,6 +28,30 @@ set -euo pipefail
cd "$(dirname "$0")"
PUBLISH_DIR="${1:?usage: publish-docs.sh <tika-site-publish-dir>}"
+
+# Guard the 'rm -rf' below: the publish dir must already exist (it's a
+# tika-site checkout, not something we create) and not be a dangerously
+# short/root path that a typo could expand to.
+if [[ ! -d "${PUBLISH_DIR}" ]]; then
+ echo "PUBLISH_DIR '${PUBLISH_DIR}' is not an existing directory." >&2
+ echo "Point it at a tika-site 'publish/' checkout." >&2
+ exit 1
+fi
+PUBLISH_DIR="$(cd "${PUBLISH_DIR}" && pwd -P)"
+if [[ "${#PUBLISH_DIR}" -lt 4 || "${PUBLISH_DIR}" != *"/"* ]]; then
+ echo "Refusing to operate on suspiciously short PUBLISH_DIR '${PUBLISH_DIR}'." >&2
+ exit 1
+fi
+# Confirm this looks like a tika-site 'publish/' dir: the documented argument
+# is always <tika-site-checkout>/publish, and the 'svn add publish/docs
+# publish/_' step downstream hardcodes that name. Refusing a non-'publish'
+# basename catches a wrong-but-valid checkout before we 'rm -rf' inside it.
Review Comment:
This comment explains the `publish/` basename check by referencing downstream SVN steps hardcoding paths, but it only mentions `publish/docs` and `publish/_`. With this script now writing `search-index.js` at the publish root, downstream steps also need to account for `publish/search-index.js`, so the comment is now incomplete/misleading.
##########
docs/supplemental-ui/partials/header-content.hbs:
##########
@@ -1,26 +1,25 @@
<header class="header">
- <nav class="navbar">
+ <nav class="navbar" aria-label="Main">
<div class="navbar-brand">
<a class="navbar-item" href="{{or siteRootPath (or site.url '/')}}">
<img src="{{{uiRootPath}}}/img/ASF_Tika-colour.svg" alt="Apache Tika" style="height: 2rem; margin-right: 0.5rem; background: white; padding: 2px 4px; border-radius: 3px;">
{{site.title}}
</a>
- <button class="navbar-burger" aria-label="Toggle navigation" data-target="topbar-nav">
+ {{#if env.SITE_SEARCH_PROVIDER}}
+ <div class="navbar-item search hide-for-print" role="search">
+ <div id="search-field" class="field">
+ <input id="search-input" type="search" aria-label="Search the docs" placeholder="Search the docs"{{#if page.home}} autofocus{{/if}}>
+ </div>
+ </div>
+ {{/if}}
Review Comment:
The search box is now gated on `env.SITE_SEARCH_PROVIDER`, but this repo’s Antora build config doesn’t set that environment variable (no occurrences in `docs/pom.xml` or playbooks). As a result, the search input will never render in typical local/CI builds even though the Lunr extension is enabled, effectively disabling search UI.
##########
docs/publish-docs.sh:
##########
@@ -40,12 +64,22 @@ mkdir -p "${DOCS_DIR}"
# Strip the 'tika/' component dir prefix so URLs are /docs/X.Y.Z/...
cp -r target/site/tika/* "${DOCS_DIR}/"
-# UI assets one level above docs/, since HTML uses ../../_/ relative paths
-cp -r target/site/_/ "${PUBLISH_DIR}/_/"
+# UI assets one level above docs/, since HTML uses ../../_/ relative paths.
+# Replace wholesale: cp -r into an existing directory nests source as a
+# subdirectory (publish/_/_/), so remove first to keep the layout flat.
+# Refuse if '_' is a symlink: 'rm -rf _/' would follow it and wipe the
+# target's contents, and the cp below needs a real directory here anyway.
+if [[ -L "${PUBLISH_DIR}/_" ]]; then
+ echo "Refusing to remove '${PUBLISH_DIR}/_': it is a symlink, not a directory." >&2
+ exit 1
+fi
+rm -rf "${PUBLISH_DIR}/_"
+cp -r target/site/_ "${PUBLISH_DIR}/_"
# Fix the root redirect and sitemap to match the flattened layout
sed 's|tika/||g' target/site/index.html > "${DOCS_DIR}/index.html"
sed 's|/docs/tika/|/docs/|g' target/site/sitemap.xml > "${DOCS_DIR}/sitemap.xml"
cp target/site/404.html "${DOCS_DIR}/"
-cp target/site/search-index.js "${DOCS_DIR}/"
+# Lunr index lives next to _/ (one level above docs/), since HTML uses ../../search-index.js
+cp target/site/search-index.js "${PUBLISH_DIR}/"
Review Comment:
`search-index.js` used to be published under `${DOCS_DIR}/` and is now published at the publish root. If someone previously ran the script, a stale `${DOCS_DIR}/search-index.js` will be left behind, which can cause confusion (and potentially be picked up by older pages/links). It’s safer to remove the old location before copying the new index.
--
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: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] TIKA-4743 improve search and navigation on site [tika]
Posted by "tballison (via GitHub)" <gi...@apache.org>.
tballison merged PR #2845:
URL: https://github.com/apache/tika/pull/2845
--
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: dev-unsubscribe@tika.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org