Skip to content
Snippets Groups Projects
Commit b4e88fe4 authored by Mario Trojan's avatar Mario Trojan Committed by Demian Katz
Browse files

import-marc-auth using solr.indexer.properties option from PROPERTIES_FILE (#1239)

parent 1d7d1dd0
No related merge requests found
...@@ -23,22 +23,6 @@ echo You need to set the VUFIND_HOME environmental variable before running this ...@@ -23,22 +23,6 @@ echo You need to set the VUFIND_HOME environmental variable before running this
goto end goto end
:vufindhomefound :vufindhomefound
rem Always use the standard authority mappings; if the user specified an override
rem file, add that to the setting.
if not exist %VUFIND_LOCAL_DIR%\import\marc_auth.properties goto nolocalmappings
set MAPPINGS_FILE=%VUFIND_LOCAL_DIR%\import\marc_auth.properties
goto mappingsset
:nolocalmappings
set MAPPINGS_FILE=%VUFIND_HOME%\import\marc_auth.properties
:mappingsset
if "!%2!"=="!!" goto noextramappings
if not exist %VUFIND_LOCAL_DIR%\import\%2 goto nolocalextramappings
set MAPPINGS_FILE=%MAPPINGS_FILE%,%VUFIND_LOCAL_DIR%\import\%2
goto noextramappings
:nolocalextramappings
set MAPPINGS_FILE=%MAPPINGS_FILE%,%VUFIND_HOME%\import\%2
:noextramappings
rem Override some settings in the standard import script: rem Override some settings in the standard import script:
if not exist %VUFIND_LOCAL_DIR%\import\import_auth.properties goto nolocalproperties if not exist %VUFIND_LOCAL_DIR%\import\import_auth.properties goto nolocalproperties
set PROPERTIES_FILE=%VUFIND_LOCAL_DIR%\import\import_auth.properties set PROPERTIES_FILE=%VUFIND_LOCAL_DIR%\import\import_auth.properties
...@@ -47,8 +31,29 @@ goto propertiesfound ...@@ -47,8 +31,29 @@ goto propertiesfound
set PROPERTIES_FILE=%VUFIND_HOME%\import\import_auth.properties set PROPERTIES_FILE=%VUFIND_HOME%\import\import_auth.properties
:propertiesfound :propertiesfound
rem Always use the authority mappings from PROPERTIES_FILE
rem if the user specified an override file, add that to the setting.
set MAPPINGS_FILENAMES=""
for /f "delims=" %%a in ('findstr "^solr.indexer.properties" %PROPERTIES_FILE%') do set MAPPINGS_FILENAMES=%%a
set MAPPINGS_FILENAMES="%MAPPINGS_FILENAMES:solr.indexer.properties=%"
if not "%2"=="" set MAPPINGS_FILENAMES=%MAPPINGS_FILENAMES%,%2
set MAPPINGS_FILENAMES=%MAPPINGS_FILENAMES:"=%
setlocal EnableDelayedExpansion
set MAPPINGS_FILES=""
for %%a in (%MAPPINGS_FILENAMES%) do (
if not !MAPPINGS_FILES!=="" set MAPPINGS_FILES=!MAPPINGS_FILES!,
if exist %VUFIND_LOCAL_DIR%\import\%%a (
set MAPPINGS_FILES=!MAPPINGS_FILES!%VUFIND_LOCAL_DIR%\import\%%a
) else (
set MAPPINGS_FILES=!MAPPINGS_FILES!%VUFIND_HOME%\import\%%a
)
)
set MAPPINGS_FILES=%MAPPINGS_FILES:~2,99999%
setlocal DisableDelayedExpansion
set SOLRCORE="authority" set SOLRCORE="authority"
set EXTRA_SOLRMARC_SETTINGS="-Dsolr.indexer.properties=%MAPPINGS_FILE%" set EXTRA_SOLRMARC_SETTINGS="-Dsolr.indexer.properties=%MAPPINGS_FILES%"
rem Call the standard script: rem Call the standard script:
call %VUFIND_HOME%\import-marc.bat %1 call %VUFIND_HOME%\import-marc.bat %1
......
...@@ -26,34 +26,38 @@ then ...@@ -26,34 +26,38 @@ then
fi fi
fi fi
# Override some settings in the standard import script:
# Always use the standard authority mappings; if the user specified an override if [ -f "$VUFIND_LOCAL_DIR/import/import_auth.properties" ]
# file, add that to the setting.
if [ -f "$VUFIND_LOCAL_DIR/import/marc_auth.properties" ]
then then
MAPPINGS_FILE="$VUFIND_LOCAL_DIR/import/marc_auth.properties" export PROPERTIES_FILE="$VUFIND_LOCAL_DIR/import/import_auth.properties"
else else
MAPPINGS_FILE="$VUFIND_HOME/import/marc_auth.properties" export PROPERTIES_FILE="$VUFIND_HOME/import/import_auth.properties"
fi fi
# Always use the authority mappings from PROPERTIES_FILE
# if the user specified an override file, add that to the setting.
MAPPINGS_FILENAMES=($(sed --quiet --expression='s/^\(solr.indexer.properties\s*=\s*\)\(.*\)/\2/p' $PROPERTIES_FILE | tr "," " "))
if [ $# -gt 1 ] if [ $# -gt 1 ]
then then
if [ -f "$VUFIND_LOCAL_DIR/import/$2" ] MAPPINGS_FILENAMES+=($2)
fi
MAPPINGS_FILES=""
for MAPPINGS_FILENAME in ${MAPPINGS_FILENAMES[@]}; do
if [ -n "$MAPPINGS_FILES" ]; then
MAPPINGS_FILES+=","
fi
if [ -f "$VUFIND_LOCAL_DIR/import/$MAPPINGS_FILENAME" ]
then then
MAPPINGS_FILE="$MAPPINGS_FILE,$VUFIND_LOCAL_DIR/import/$2" MAPPINGS_FILES+="$VUFIND_LOCAL_DIR/import/$MAPPINGS_FILENAME"
else else
MAPPINGS_FILE="$MAPPINGS_FILE,$VUFIND_HOME/import/$2" MAPPINGS_FILES+="$VUFIND_HOME/import/$MAPPINGS_FILENAME"
fi fi
fi done
# Override some settings in the standard import script:
if [ -f "$VUFIND_LOCAL_DIR/import/import_auth.properties" ]
then
export PROPERTIES_FILE="$VUFIND_LOCAL_DIR/import/import_auth.properties"
else
export PROPERTIES_FILE="$VUFIND_HOME/import/import_auth.properties"
fi
export SOLRCORE="authority" export SOLRCORE="authority"
export EXTRA_SOLRMARC_SETTINGS="-Dsolr.indexer.properties=$MAPPINGS_FILE" export EXTRA_SOLRMARC_SETTINGS="-Dsolr.indexer.properties=$MAPPINGS_FILES"
# Call the standard script: # Call the standard script:
$VUFIND_HOME/import-marc.sh $1 $VUFIND_HOME/import-marc.sh $1
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment