You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ta...@apache.org on 2026/05/28 13:19:09 UTC

(tika) branch TIKA-4743-improve-site created (now fe32b0f707)

This is an automated email from the ASF dual-hosted git repository.

tballison pushed a change to branch TIKA-4743-improve-site
in repository https://gitbox.apache.org/repos/asf/tika.git


      at fe32b0f707 TIKA-4743 improve search and navigation on site

This branch includes the following new commits:

     new fe32b0f707 TIKA-4743 improve search and navigation on site

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(tika) 01/01: TIKA-4743 improve search and navigation on site

Posted by ta...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tballison pushed a commit to branch TIKA-4743-improve-site
in repository https://gitbox.apache.org/repos/asf/tika.git

commit fe32b0f707b6512eaf5fa154a7ee44a9491d31a8
Author: tallison <ta...@apache.org>
AuthorDate: Thu May 28 09:07:47 2026 -0400

    TIKA-4743 improve search and navigation on site
---
 .../release-guides/release-artifacts.adoc          |   2 +-
 docs/publish-docs.sh                               |  10 +-
 docs/supplemental-ui/css/search.css                |  82 --------------
 docs/supplemental-ui/js/search.js                  | 119 ---------------------
 docs/supplemental-ui/partials/footer-scripts.hbs   |   1 -
 docs/supplemental-ui/partials/head-scripts.hbs     |   1 -
 docs/supplemental-ui/partials/header-content.hbs   |  17 ++-
 7 files changed, 16 insertions(+), 216 deletions(-)

diff --git a/docs/modules/ROOT/pages/maintainers/release-guides/release-artifacts.adoc b/docs/modules/ROOT/pages/maintainers/release-guides/release-artifacts.adoc
index 8059875491..073757fed8 100644
--- a/docs/modules/ROOT/pages/maintainers/release-guides/release-artifacts.adoc
+++ b/docs/modules/ROOT/pages/maintainers/release-guides/release-artifacts.adoc
@@ -230,4 +230,4 @@ The `release-tika-server` job builds from `tika-server-standard-<v>.zip`
 
 * xref:maintainers/release-guides/tika.adoc[Releasing Apache Tika]
 * xref:maintainers/release-guides/docker.adoc[Releasing Tika Docker Images]
-* xref:maintainers/release-guides/site-updates.adoc[Updating the Website After a Release]
+* xref:maintainers/site.adoc[Updating the Website After a Release]
diff --git a/docs/publish-docs.sh b/docs/publish-docs.sh
index fcbed4e995..6511071f87 100755
--- a/docs/publish-docs.sh
+++ b/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}/_"
 # 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}/"
 
 echo "Published to: ${DOCS_DIR}/"
diff --git a/docs/supplemental-ui/css/search.css b/docs/supplemental-ui/css/search.css
deleted file mode 100644
index 5fac6cf03b..0000000000
--- a/docs/supplemental-ui/css/search.css
+++ /dev/null
@@ -1,82 +0,0 @@
-.navbar .search {
-  position: relative;
-  margin-right: 0.5rem;
-}
-
-#search-input {
-  border: 1px solid #dbdbdb;
-  border-radius: 4px;
-  padding: 0.375rem 0.625rem;
-  font-size: 0.875rem;
-  width: 200px;
-  background: #fff;
-}
-
-#search-input:focus {
-  border-color: #3273dc;
-  outline: none;
-  box-shadow: 0 0 0 0.125em rgba(50, 115, 220, 0.25);
-}
-
-#search-results {
-  display: none;
-  position: absolute;
-  top: 100%;
-  right: 0;
-  background: white;
-  border: 1px solid #dbdbdb;
-  border-radius: 4px;
-  max-height: 400px;
-  overflow-y: auto;
-  width: 350px;
-  z-index: 1000;
-  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
-  margin-top: 0.25rem;
-}
-
-.search-result-item {
-  padding: 0.75rem 1rem;
-  border-bottom: 1px solid #f0f0f0;
-}
-
-.search-result-item:last-child {
-  border-bottom: none;
-}
-
-.search-result-item:hover {
-  background: #f5f5f5;
-}
-
-.search-result-item a {
-  color: #363636;
-  text-decoration: none;
-  display: block;
-}
-
-.search-result-item .title {
-  font-weight: 600;
-  margin-bottom: 0.25rem;
-}
-
-.search-result-item .text {
-  font-size: 0.8125rem;
-  color: #666;
-  line-height: 1.4;
-}
-
-/* Footer styles */
-.footer {
-  background: #363636;
-  color: #b5b5b5;
-  padding: 1.5rem;
-  text-align: center;
-  font-size: 0.875rem;
-}
-
-.footer p {
-  margin: 0.25rem 0;
-}
-
-.footer a {
-  color: #fff;
-}
diff --git a/docs/supplemental-ui/js/search.js b/docs/supplemental-ui/js/search.js
deleted file mode 100644
index 00af02312d..0000000000
--- a/docs/supplemental-ui/js/search.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Search functionality for Antora with Lunr */
-(function () {
-  'use strict'
-
-  var defined = function (val) {
-    return typeof val !== 'undefined'
-  }
-
-  var searchInput = document.getElementById('search-input')
-  var searchResults = document.getElementById('search-results')
-
-  if (!searchInput || !searchResults) return
-
-  var index = null
-  var store = null
-  var indexLoaded = false
-
-  // Determine the base path for the search index
-  var siteRootPath = document.body.dataset.siteRootPath || ''
-  var indexPath = siteRootPath + '/search-index.js'
-
-  // Load the search index
-  var script = document.createElement('script')
-  script.src = indexPath
-  script.onload = function () {
-    if (typeof antoraSearch !== 'undefined' && defined(antoraSearch.index) && defined(antoraSearch.store)) {
-      index = lunr.Index.load(antoraSearch.index)
-      store = antoraSearch.store
-      indexLoaded = true
-    }
-  }
-  document.head.appendChild(script)
-
-  // Load Lunr if not already loaded
-  if (typeof lunr === 'undefined') {
-    var lunrScript = document.createElement('script')
-    lunrScript.src = 'https://unpkg.com/lunr@2.3.9/lunr.min.js'
-    document.head.appendChild(lunrScript)
-  }
-
-  searchInput.addEventListener('input', debounce(search, 200))
-  searchInput.addEventListener('focus', function () {
-    if (this.value.length > 1) search()
-  })
-
-  document.addEventListener('click', function (e) {
-    if (!e.target.closest('.search')) {
-      searchResults.innerHTML = ''
-      searchResults.style.display = 'none'
-    }
-  })
-
-  function search () {
-    var query = searchInput.value.trim()
-
-    if (query.length < 2) {
-      searchResults.innerHTML = ''
-      searchResults.style.display = 'none'
-      return
-    }
-
-    if (!indexLoaded) {
-      searchResults.innerHTML = '<div class="search-result-item">Loading search index...</div>'
-      searchResults.style.display = 'block'
-      return
-    }
-
-    var results = []
-    try {
-      results = index.search(query)
-    } catch (e) {
-      // Try wildcard search if exact search fails
-      try {
-        results = index.search(query + '*')
-      } catch (e2) {
-        results = []
-      }
-    }
-
-    if (results.length === 0) {
-      searchResults.innerHTML = '<div class="search-result-item">No results found</div>'
-      searchResults.style.display = 'block'
-      return
-    }
-
-    var html = results.slice(0, 10).map(function (result) {
-      var doc = store[result.ref]
-      if (!doc) return ''
-      var title = doc.title || 'Untitled'
-      var text = doc.text || ''
-      if (text.length > 150) text = text.substring(0, 150) + '...'
-      return '<div class="search-result-item"><a href="' + doc.url + '">' +
-        '<div class="title">' + escapeHtml(title) + '</div>' +
-        '<div class="text">' + escapeHtml(text) + '</div>' +
-        '</a></div>'
-    }).join('')
-
-    searchResults.innerHTML = html
-    searchResults.style.display = 'block'
-  }
-
-  function debounce (fn, delay) {
-    var timeout
-    return function () {
-      var context = this
-      var args = arguments
-      clearTimeout(timeout)
-      timeout = setTimeout(function () {
-        fn.apply(context, args)
-      }, delay)
-    }
-  }
-
-  function escapeHtml (text) {
-    var div = document.createElement('div')
-    div.textContent = text
-    return div.innerHTML
-  }
-})()
diff --git a/docs/supplemental-ui/partials/footer-scripts.hbs b/docs/supplemental-ui/partials/footer-scripts.hbs
deleted file mode 100644
index 9aa19101f1..0000000000
--- a/docs/supplemental-ui/partials/footer-scripts.hbs
+++ /dev/null
@@ -1 +0,0 @@
-<script src="{{{uiRootPath}}}/js/search.js"></script>
diff --git a/docs/supplemental-ui/partials/head-scripts.hbs b/docs/supplemental-ui/partials/head-scripts.hbs
deleted file mode 100644
index d5752e8e11..0000000000
--- a/docs/supplemental-ui/partials/head-scripts.hbs
+++ /dev/null
@@ -1 +0,0 @@
-<link rel="stylesheet" href="{{{uiRootPath}}}/css/search.css">
diff --git a/docs/supplemental-ui/partials/header-content.hbs b/docs/supplemental-ui/partials/header-content.hbs
index 88488dfbe9..d5836389a6 100644
--- a/docs/supplemental-ui/partials/header-content.hbs
+++ b/docs/supplemental-ui/partials/header-content.hbs
@@ -5,7 +5,14 @@
         <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}}>
+        </div>
+      </div>
+      {{/if}}
+      <button class="navbar-burger" aria-controls="topbar-nav" aria-expanded="false" aria-label="Toggle main menu" data-target="topbar-nav">
         <span></span>
         <span></span>
         <span></span>
@@ -13,14 +20,6 @@
     </div>
     <div id="topbar-nav" class="navbar-menu">
       <div class="navbar-end">
-        <div class="navbar-item search">
-          <div class="field has-addons">
-            <p class="control">
-              <input id="search-input" class="input" type="text" placeholder="Search docs...">
-            </p>
-          </div>
-          <div id="search-results"></div>
-        </div>
         <a class="navbar-item" href="https://tika.apache.org">Apache Tika</a>
         <a class="navbar-item" href="https://github.com/apache/tika">GitHub</a>
       </div>