[ 
https://issues.apache.org/jira/browse/TIKA-4743?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18085219#comment-18085219
 ] 

ASF GitHub Bot commented on TIKA-4743:
--------------------------------------

Copilot commented on code in PR #2860:
URL: https://github.com/apache/tika/pull/2860#discussion_r3334247883


##########
docs/publish-docs.sh:
##########
@@ -83,6 +83,11 @@ cp target/site/404.html "${DOCS_DIR}/"
 # Lunr index lives next to _/ (one level above docs/), since HTML uses 
../../search-index.js.
 # Remove the stale copy from its old publish/docs/ location left by earlier 
runs.
 rm -f "${DOCS_DIR}/search-index.js"
-cp target/site/search-index.js "${PUBLISH_DIR}/"
+# Rewrite URLs in the search index from /tika/X.Y.Z/... (Antora's component-
+# prefixed publish path) to /docs/X.Y.Z/... (the deployed layout). The HTML
+# pages and sitemap.xml above are similarly flattened; without this rewrite,
+# clicking a search result lands on https://tika.apache.org/tika/... which
+# 404s. See TIKA-4743.
+sed 's|"url":"/tika/|"url":"/docs/|g' target/site/search-index.js > 
"${PUBLISH_DIR}/search-index.js"

Review Comment:
   Because of shell redirection semantics, this command will truncate/create 
`${PUBLISH_DIR}/search-index.js` before `sed` runs. If 
`target/site/search-index.js` is missing or `sed` errors, the published search 
index can be left empty even though the script exits non-zero. Consider writing 
to a temporary file first (and explicitly failing with a clear message if the 
input file is missing) so a failed rewrite can’t corrupt an existing published 
index.





> tika-4.0.0-alpha1 - documentation site
> --------------------------------------
>
>                 Key: TIKA-4743
>                 URL: https://issues.apache.org/jira/browse/TIKA-4743
>             Project: Tika
>          Issue Type: Bug
>    Affects Versions: 4.0.0
>            Reporter: Adrian Bird
>            Priority: Minor
>
> A couple of comments about the [Apache Tika Documentation 
> site|https://tika.apache.org/docs/4.0.0-SNAPSHOT/index.html].
>  * I was expecting the menu items on the left to open and show lower level 
> pages where they have a triangle, but they don't. This does make it tricky to 
> navigate because you have to do it via the links on the pages themselves.
>  * Search - trying to use the search feature pops up a small box with the 
> text 'Loading search index...' (in white on the light gray background means 
> it isn't really visible) and nothing happens i.e. no search results are 
> displayed.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to