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

houston pushed a commit to branch jira/solr-15556-antora
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/jira/solr-15556-antora by this 
push:
     new a144493  Enable site search through the antora lunr extension
a144493 is described below

commit a144493d4e0f2574e076cab4908f84ce4de7242a
Author: Houston Putman <[email protected]>
AuthorDate: Thu Feb 3 18:50:46 2022 -0500

    Enable site search through the antora lunr extension
---
 solr/solr-ref-guide/build.gradle                       | 14 ++++++++++++--
 solr/solr-ref-guide/playbook.template.yml              |  4 ++++
 solr/solr-ref-guide/ui-src/layouts/default.hbs         | 11 -----------
 solr/solr-ref-guide/ui-src/partials/header-content.hbs | 12 ++++++++++--
 4 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/solr/solr-ref-guide/build.gradle b/solr/solr-ref-guide/build.gradle
index 5389f76..9b24e76 100644
--- a/solr/solr-ref-guide/build.gradle
+++ b/solr/solr-ref-guide/build.gradle
@@ -129,6 +129,7 @@ task buildLocalAntoraPlaybookYaml(type: Copy) {
         'site_url'        : "",
         'source_url'      : projectDir.parentFile.parentFile.path,
         'source_branches' : "HEAD",
+        'supplemental_files' : 
"${project.ext.nodeProjectDir}/node_modules/@antora/lunr-extension/supplemental_ui",
     ])
 }
 
@@ -146,6 +147,7 @@ task buildOfficialAntoraPlaybookYaml(type: Copy) {
         'site_url'        : "https://solr.apache.org/guide";,
         'source_url'      : "https://github.com/apache/solr.git";,
         'source_branches' : ["jira/solr-15556-antora"],
+        'supplemental_files' : 
"${project.ext.nodeProjectDir}/node_modules/@antora/lunr-extension/supplemental_ui",
     ])
 }
 
@@ -194,14 +196,20 @@ task downloadAntoraSiteGenerator(type: NpmTask) {
     
outputs.dir("${project.ext.nodeProjectDir}/node_modules/@antora/site-generator-default")
 }
 
+task downloadAntoraLunrExtension(type: NpmTask) {
+    args = ["install", "@antora/lunr-extension"]
+
+    inputs.files("${project.ext.nodeProjectDir}/package.json")
+    
outputs.dir("${project.ext.nodeProjectDir}/node_modules/@antora/lunr-extension")
+}
+
 task downloadAntora {
     dependsOn tasks.downloadAntoraCli
     dependsOn tasks.downloadAntoraSiteGenerator
+    dependsOn tasks.downloadAntoraLunrExtension
 }
 
 task downloadLinkValidator(type: NpmTask) {
-    dependsOn tasks.downloadAntoraCli
-
     args = ["install", "link-checker"]
 
     inputs.files("${project.ext.nodeProjectDir}/package.json")
@@ -315,6 +323,8 @@ task buildSite(type: NpxTask) {
         "--to-dir=${project.ext.siteDir}",
     ] + extraArgs
 
+    environment = ["SITE_SEARCH_ENABLED": "true"]
+
     inputs.files(fileTree("${projectDir}/modules"))
     inputs.files("${projectDir}/antora.yml")
     inputs.files(project.ext.playbookFilePath)
diff --git a/solr/solr-ref-guide/playbook.template.yml 
b/solr/solr-ref-guide/playbook.template.yml
index b84ee55..3259c56 100644
--- a/solr/solr-ref-guide/playbook.template.yml
+++ b/solr/solr-ref-guide/playbook.template.yml
@@ -23,6 +23,7 @@ ui:
   bundle:
     url: "https://nightlies.apache.org/solr/draft-guides/ui-bundle.zip";
     snapshot: true
+  supplemental_files: "${supplemental_files}"
 output:
   clean: true
   dir: ./build/site
@@ -31,3 +32,6 @@ asciidoc:
     stem:
 runtime:
   fetch: true
+antora:
+  extensions:
+    - '@antora/lunr-extension'
diff --git a/solr/solr-ref-guide/ui-src/layouts/default.hbs 
b/solr/solr-ref-guide/ui-src/layouts/default.hbs
deleted file mode 100644
index c5282ec..0000000
--- a/solr/solr-ref-guide/ui-src/layouts/default.hbs
+++ /dev/null
@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-  <head>
-{{> head defaultPageTitle='Untitled'}}
-  </head>
-  <body class="article{{#with (or page.attributes.role page.role)}} 
{{{this}}}{{/with}}">
-{{> header}}
-{{> body}}
-{{> footer}}
-  </body>
-</html>
diff --git a/solr/solr-ref-guide/ui-src/partials/header-content.hbs 
b/solr/solr-ref-guide/ui-src/partials/header-content.hbs
index c23cf0b..63635ad 100644
--- a/solr/solr-ref-guide/ui-src/partials/header-content.hbs
+++ b/solr/solr-ref-guide/ui-src/partials/header-content.hbs
@@ -1,10 +1,18 @@
 <header class="header">
   <nav class="navbar">
     <div class="navbar-brand">
-      <!-- Solr Additions - Start -->
+      <!-- Solr Changes - Start -->
       <img class="navbar-item" 
src="{{{uiRootPath}}}/img/solr-sunOnly-small.png" width="30" height="30">
-      <!-- Solr Additions - End -->
       <a class="navbar-item" href="{{{or site.url  
siteRootPath}}}">{{site.title}}</a>
+      <!-- Solr Changes - End -->
+      {{#if env.SITE_SEARCH_ENABLED}}
+        <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" data-target="topbar-nav">
         <span></span>
         <span></span>

Reply via email to