From 58ae6f5571770ab228208ddc15882ff0940e44ab Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Mon, 17 Dec 2012 11:37:12 -0500
Subject: [PATCH] Adjusted Solr/alphabrowse configuration in preparation for
 collection browse option.

---
 index-alphabetic-browse.bat     | 1 +
 index-alphabetic-browse.sh      | 2 +-
 solr/biblio/conf/schema.xml     | 7 +++++++
 solr/biblio/conf/solrconfig.xml | 6 +++++-
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/index-alphabetic-browse.bat b/index-alphabetic-browse.bat
index 893e0c8a36a..2b16e8f46e2 100644
--- a/index-alphabetic-browse.bat
+++ b/index-alphabetic-browse.bat
@@ -59,6 +59,7 @@ if exist %index_dir% goto nomakeindexdir
 mkdir "%index_dir%"
 :nomakeindexdir
 
+call %VUFIND_HOME%\index-alphabetic-browse.bat build_browse hierarchy hierarchy_browse
 call %VUFIND_HOME%\index-alphabetic-browse.bat build_browse title title_fullStr 1 "-Dbibleech=StoredFieldLeech -Dsortfield=title_sort -Dvaluefield=title_fullStr"
 call %VUFIND_HOME%\index-alphabetic-browse.bat build_browse topic topic_browse
 call %VUFIND_HOME%\index-alphabetic-browse.bat build_browse author author_browse
diff --git a/index-alphabetic-browse.sh b/index-alphabetic-browse.sh
index 19380969d45..1aa95d5db12 100755
--- a/index-alphabetic-browse.sh
+++ b/index-alphabetic-browse.sh
@@ -34,7 +34,7 @@ function build_browse
     mv "${browse}_browse.db" "$index_dir/${browse}_browse.db-updated"
     touch "$index_dir/${browse}_browse.db-ready"
 }
-
+build_browse "hierarchy" "hierarchy_browse"
 build_browse "title" "title_fullStr" 1 "-Dbibleech=StoredFieldLeech -Dsortfield=title_sort -Dvaluefield=title_fullStr"
 build_browse "topic" "topic_browse"
 build_browse "author" "author_browse"
diff --git a/solr/biblio/conf/schema.xml b/solr/biblio/conf/schema.xml
index e7ec375b603..205fc1ac2d4 100644
--- a/solr/biblio/conf/schema.xml
+++ b/solr/biblio/conf/schema.xml
@@ -9,6 +9,12 @@
         <filter class="solr.PatternReplaceFilterFactory" pattern="(?&lt;!\b[A-Z])[.\s]*$" replacement="" replace="first"/>
       </analyzer>
     </fieldType>
+    <fieldType name="textFacetRaw" class="solr.TextField" sortMissingLast="true" omitNorms="true">
+      <analyzer>
+        <tokenizer class="solr.KeywordTokenizerFactory"/>
+        <!-- this is just like textFacet but without punctuation stripping. -->
+      </analyzer>
+    </fieldType>
     <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
       <analyzer type="index">
         <tokenizer class="solr.ICUTokenizerFactory"/>
@@ -185,6 +191,7 @@
    <field name="hierarchy_sequence" type="string" indexed="true" stored="true" multiValued="true"/>
    <field name="is_hierarchy_id" type="string" indexed="true" stored="true" multiValued="false"/>
    <field name="is_hierarchy_title" type="string" indexed="true" stored="true" multiValued="false"/>
+   <field name="hierarchy_browse" type="textFacetRaw" indexed="true" stored="false" multiValued="true"/>
    <!-- Used for loading correct record driver -->
    <field name="recordtype" type="string" indexed="false" stored="true"/>
    <!-- Tracking fields to keep track of oldest and most recent index times -->
diff --git a/solr/biblio/conf/solrconfig.xml b/solr/biblio/conf/solrconfig.xml
index ef1d5df2ee1..1c4180d1ff0 100644
--- a/solr/biblio/conf/solrconfig.xml
+++ b/solr/biblio/conf/solrconfig.xml
@@ -469,7 +469,7 @@
     <str name="scopeNoteField">scope_note</str>
 
 
-    <str name="sources">topic,author,title,lcc,dewey</str>
+    <str name="sources">topic,author,title,lcc,dewey,hierarchy</str>
 
     <lst name="topic">
       <str name="DBpath">${solr.solr.home:./solr}/alphabetical_browse/topic_browse.db</str>
@@ -497,6 +497,10 @@
       <str name="ignoreDiacritics">yes</str>
     </lst>
 
+    <lst name="hierarchy">
+      <str name="DBpath">${solr.solr.home:./solr}/alphabetical_browse/hierarchy_browse.db</str>
+      <str name="field">hierarchy_browse</str>
+    </lst>
   </requestHandler>
 
   <searchComponent name="spellcheck" class="org.apache.solr.handler.component.SpellCheckComponent">
-- 
GitLab