summaryrefslogtreecommitdiff
path: root/localrundig
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2002-01-21 04:06:50 +0000
committerJonas Smedegaard <dr@jones.dk>2002-01-21 04:06:50 +0000
commit368a3a19ed6f6026cd3817e8f714f71b11601167 (patch)
treeaf1b813e9d8bdd385b7516f354dec438bb6eea03 /localrundig
parent5148c4cc699884c13895992a889d397afc60c64f (diff)
Changes to localrundig and begin work on localwebsearch (works from cron only).
Diffstat (limited to 'localrundig')
-rwxr-xr-xlocalrundig47
1 files changed, 31 insertions, 16 deletions
diff --git a/localrundig b/localrundig
index e1928a0..ee81ed5 100755
--- a/localrundig
+++ b/localrundig
@@ -3,7 +3,7 @@
#
# rundig
#
-# $Id: localrundig,v 1.1 2002-01-21 00:18:07 jonas Exp $
+# $Id: localrundig,v 1.2 2002-01-21 04:06:50 jonas Exp $
#
# This is a sample script to create a search database for ht://Dig.
#
@@ -11,6 +11,8 @@ DBDIR=/var/lib/htdig
COMMONDIR=/etc/htdig
BINDIR=/usr/bin
+LOCALLIBDIR=/usr/local/lib/htdig
+LOCALDBDIR=/var/local/lib/htdig
# To help debug problems, try running rundig -vvv
# This will add lots of debugging output to all of the programs
stats= opts= alt= init=
@@ -24,6 +26,15 @@ do
esac
done
+config=`echo "$opts"|sed 's/.*-c[[:space:]]\+\([[:alnum:]/.]\+\).*/\1/'`
+test -n "$config" || config=/etc/htdig/htdig.conf
+locale=`grep '^locale:' $config | sed -e 's/.*:[[:space:]]*\([[:alnum:]_]\+\).*/\1/'`
+test -n "$locale" || locale=en_US
+search_object=`grep '^search_object:' $config | sed -e 's/.*:[[:space:]]*\([[:alnum:]_]\+\).*/\1/'`
+echo grep '^search_object:' $config | sed -e 's/.*:[[:space:]]*\([[:alnum:]_]\+\).*/\1/'
+echo "S: $search_object C: $config"
+test -d $LOCALDBDIR/db/$search_object || mkdir $LOCALDBDIR/db/$search_object
+
#
# Set the TMPDIR variable if you want htmerge to put files in a location
# other than the default. This is important if you do not have enough
@@ -52,24 +63,28 @@ esac
# Keep only the following files (and don't call htdig with -i):
# db.docdb, db.docdb.work, db.docs.index, db.wordlist.work, db.words.db
$BINDIR/htnotify $opts
-# If you want to use the soundex and (or) metaphone fuzzy matchings,
-# Uncomment the following line
-# $BINDIR/htfuzzy $opts soundex metaphone
#
# Create the endings and synonym databases if they don't exist
# or if they're older than the files they're generated from.
# These databases are semi-static, so even if pages change,
# these databases will not need to be rebuilt.
-#
-#if [ "`ls -t $COMMONDIR/english.0 $COMMONDIR/word2root.db 2>/dev/null | sed 1q`" = \
-# "$COMMONDIR/english.0" ]
-#then
-# $BINDIR/htfuzzy $opts endings
-#fi
-#
-#if [ "`ls -t $COMMONDIR/synonyms $COMMONDIR/synonyms.db 2>/dev/null | sed 1q`" = \
-# "$COMMONDIR/synonyms" ]
-#then
-# $BINDIR/htfuzzy $opts synonyms
-#fi
+
+case "$locale" in
+en_*)
+ $BINDIR/htfuzzy $opts metaphone ;;
+*)
+ $BINDIR/htfuzzy $opts soundex ;;
+esac
+
+if [ "`ls -t $LOCALLIBDIR/lang/$locale/dict.0 $LOCALDBDIR/lang/$locale/word2root.db 2>/dev/null | sed 1q`" = \
+ "$LOCALLIBDIR/lang/$locale/dict.0" ]
+then
+ $BINDIR/htfuzzy $opts endings
+fi
+
+if [ "`ls -t $LOCALLIBDIR/lang/$locale/synonyms $LOCALDBDIR/lang/$locale/synonyms.db 2>/dev/null | sed 1q`" = \
+ "$LOCALLIBDIR/lang/$locale/synonyms" ]
+then
+ $BINDIR/htfuzzy $opts synonyms
+fi