Sha256: bf6590425ae57ba70a3e0ae0af9613af55d3a3f209437eacbc0113a2922b4f4c

Contents?: true

Size: 1.67 KB

Versions: 84

Compression:

Stored size: 1.67 KB

Contents

import org.marc4j.marc.Record;
import org.solrmarc.tools.Utils;
import org.solrmarc.tools.CallNumUtils;

// define the base level indexer so that its methods can be called from the script.
// note that the SolrIndexer code will set this value before the script methods are called.
org.solrmarc.index.SolrIndexer indexer = null;

/**
 * returns the facet value for dewey hundreds digits, and dewey tens digits
 * @param record
 * @return Set of Strings containing facet value for dewey hundreds digits, and dewey tens digits
 */
Set getDeweyFacet(Record record, String propertiesMapName)
{
    LinkedHashSet resultSet = new LinkedHashSet();
    Set values = indexer.getFieldList(record, "082a");
    String mapName = indexer.loadTranslationMap(propertiesMapName);

    for (String dewey : values)
    {
        if (! CallNumUtils.isValidDewey(dewey))  continue;
        String hundreds = dewey.substring(0, 1) + "00";
        String tens = dewey.substring(0,2) + "0";
        String hundredsMapped = Utils.remap(hundreds, indexer.findMap(mapName), true);
        String tensMapped = Utils.remap(tens, indexer.findMap(mapName), true);
        if (hundredsMapped != null) resultSet.add(hundredsMapped);
        if (tensMapped != null) resultSet.add(tensMapped);
    }

    return resultSet;
}

Set getDeweyText(Record record)
{
    LinkedHashSet resultSet = new LinkedHashSet();
    Set values = indexer.getFieldList(record, "082a");

    for (String dewey : values)
    {
        if (! CallNumUtils.isValidDewey(dewey))  continue;
        dewey = dewey.replaceAll("/[.]", ".").replaceAll("/", " ");
        resultSet.add(dewey);
    }

    return resultSet;
}

Version data entries

84 entries across 84 versions & 6 rubygems

Version Path
blacklight-4.9.0 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.8.0 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-marc-5.10.0 lib/generators/blacklight/marc/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-marc-5.5.0 lib/generators/blacklight_marc/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-marc-5.4.0 lib/generators/blacklight_marc/templates/config/SolrMarc/index_scripts/dewey.bsh
curate-0.6.6 spec/internal/config/SolrMarc/index_scripts/dewey.bsh
blacklight-marc-5.0.0 lib/generators/blacklight_marc/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.7.0 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.7.0.pre1 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
curate-0.6.4 spec/internal/config/SolrMarc/index_scripts/dewey.bsh
blacklight_marc-0.0.9 lib/generators/blacklight_marc/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight_marc-0.0.8 lib/generators/blacklight_marc/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight_marc-0.0.7 lib/generators/blacklight_marc/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.6.3 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.6.2 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.6.1 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.6.0 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight_marc-0.0.6 lib/generators/blacklight_marc/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight_marc-0.0.5 lib/generators/blacklight_marc/templates/config/SolrMarc/index_scripts/dewey.bsh
curate-0.6.3 spec/internal/config/SolrMarc/index_scripts/dewey.bsh