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
curate-0.6.1 spec/internal/config/SolrMarc/index_scripts/dewey.bsh
curate-0.6.0 spec/internal/config/SolrMarc/index_scripts/dewey.bsh
curate-0.5.6 spec/internal/config/SolrMarc/index_scripts/dewey.bsh
curate-0.5.5 spec/internal/config/SolrMarc/index_scripts/dewey.bsh
curate-0.5.4 spec/internal/config/SolrMarc/index_scripts/dewey.bsh
curate-0.5.2 spec/internal/config/SolrMarc/index_scripts/dewey.bsh
curate-0.5.1 spec/internal/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.5.0 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
curate-0.5.0 spec/internal/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.5.0.rc1 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.4.2 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight_marc-0.0.4 lib/generators/blacklight_marc/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.4.1 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight_marc-0.0.3 lib/generators/blacklight_marc/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight_marc-0.0.2 lib/generators/blacklight_marc/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.4.0 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
blacklight-4.3.0 lib/generators/blacklight/templates/config/SolrMarc/index_scripts/dewey.bsh
hydra_mediated-0.0.1 config/SolrMarc/index_scripts/dewey.bsh
hydra-editor-0.0.5 spec/dummy/config/SolrMarc/index_scripts/dewey.bsh
hydra-editor-0.0.4 spec/dummy/config/SolrMarc/index_scripts/dewey.bsh