VuFind
  1. VuFind
  2. VUFIND-657

Normalized LC Callnumber field

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Trivial Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.4
    • Component/s: Import Tools
    • Labels:
      None

      Description

      Using the Normalization script available in the SolrMarc tools, it's possible to create a normalization plugin for Solr. This will produce a Normalized LC Callnumber which can then be used for accurate callnumber sorting and range searches.

      Instructions:

      1) Drop the vuFindTools.Jar file into solr/lib

      2) Edit schema.xml

      <fieldType name="LCNormalized" class="solr.TextField" sortMissingLast="true" omitNorms="true">
        <analyzer>
          <tokenizer class="solr.KeywordTokenizerFactory"/>
          <filter class="org.vufind.solr.analysis.LCCNormalizeFilterFactory"/>
        </analyzer>
      </fieldType>

      <field name="callnumber-normalized" type="LCNormalized" indexed="true" stored="false" />

      3a) Edit callnumber.bsh

      /**
       * Extract the raw call number a record
       * @param record
       * @return Call number
       */
      public String getRawFullCallNumber(Record record, String fieldSpec) {

          String val = indexer.getFirstFieldVal(record, fieldSpec);
          return val;
      }

      3b) Edit marc_local.properties

      callnumber-normalized = script(callnumber.bsh), getRawFullCallNumber(099ab:090ab:050ab)

      4) Edit searches.ini

      [sorting]
      callnumber = callnumber-normalized

      5) Re-index

      6) VuFind is not set up to perform ranged searches other than published date - to see the callnumber range search in option search under allfields for:

      callnumber-normalized:[AD400 TO CG8000]
      1. callnumberRange.patch
        12 kB
        Luke O'Sullivan
      2. LCCNormalizeFilter.class
        7 kB
        Luke O'Sullivan
      3. LCCNormalizeFilter.java
        12 kB
        Luke O'Sullivan
      4. LCCNormalizeFilterFactory.class
        0.7 kB
        Luke O'Sullivan
      5. LCCNormalizeFilterFactory.java
        0.3 kB
        Luke O'Sullivan

        Activity

        Hide
        Luke O'Sullivan added a comment - - edited
        I have attached the LCC Java Files as requested

        They basically mirror the index script so should be updated to match that
        Show
        Luke O'Sullivan added a comment - - edited I have attached the LCC Java Files as requested They basically mirror the index script so should be updated to match that
        Hide
        Demian Katz added a comment -
        I have adapted the range logic from the attached patch into https://github.com/vufind-org/vufind/pull/115 (with some additions/improvements).
        Show
        Demian Katz added a comment - I have adapted the range logic from the attached patch into https://github.com/vufind-org/vufind/pull/115 (with some additions/improvements).
        Hide
        Demian Katz added a comment -
        Now that VUFIND-919 is implemented, we may want to regenerate patches here to use the new configurable generic range functionality.
        Show
        Demian Katz added a comment - Now that VUFIND-919 is implemented, we may want to regenerate patches here to use the new configurable generic range functionality.
        Hide
        Luke O'Sullivan added a comment -
        I've updated the VuFindTools.jar file to work with version 4.2.1 and to use the methods found in SolrMarc. Unfortunately, as Solr/Lucene have changed things around and SolrMarc requires certain libraries to work, this has increased the dependencies required for the Filter. In addition to VuFindTools.jar, you will also need to add SolrMarc.jar, MarcImporter.jar, marc4j-2.6.0.jar and lucene-analzers-common-4.2.1.jar to the lib directory.

        I'm sure someone with even a modicum of Java experience could put them all together in one package (and select the individual classes required) - I really am just hacking things together.

        Initial tests seem promising though - Sorting and range searching appear to be working

         

        Show
        Luke O'Sullivan added a comment - I've updated the VuFindTools.jar file to work with version 4.2.1 and to use the methods found in SolrMarc. Unfortunately, as Solr/Lucene have changed things around and SolrMarc requires certain libraries to work, this has increased the dependencies required for the Filter. In addition to VuFindTools.jar, you will also need to add SolrMarc.jar, MarcImporter.jar, marc4j-2.6.0.jar and lucene-analzers-common-4.2.1.jar to the lib directory. I'm sure someone with even a modicum of Java experience could put them all together in one package (and select the individual classes required) - I really am just hacking things together. Initial tests seem promising though - Sorting and range searching appear to be working  
        Hide
        Demian Katz added a comment -
        Call number normalization issues were addressed in release 2.4.
        Show
        Demian Katz added a comment - Call number normalization issues were addressed in release 2.4.

          People

          • Assignee:
            Unassigned
            Reporter:
            Luke O'Sullivan
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: