#! /bin/bash
# indextest.sh
# Diagnostic program to show how a set of marc records would be indexed,
# without actually adding any records to Solr.
# $Id: indextest.sh 

E_BADARGS=65

scriptdir=$( (cd -P $(dirname $0) && pwd) )
if ! [ -e $scriptdir/SolrMarc.jar ] 
then
  scriptdir=$( (cd -P $(dirname $0)/.. && pwd) )
fi

if ! [ -p /dev/stdin ]
then  
  if [ $# -eq 0 ]
  then
    echo "    Usage: `basename $0` [config.properties] ./path/to/marc.mrc "
    echo "      Note that if the config.properties file is not specified the Jarfile will be searched for"
    echo "      a file whose name ends with \"config.properties\""
    exit $E_BADARGS
  fi
fi

java -Dsolrmarc.main.class="org.solrmarc.marc.MarcPrinter" -jar $scriptdir/SolrMarc.jar index $1 $2 $3

exit 0

