Handle partial indexing of document restricted to metadata from extended attributes
This commit is contained in:
@@ -5,6 +5,7 @@ daemloglevel = 6
|
||||
daemlogfilename = /tmp/rclmontrace
|
||||
|
||||
indexStripChars = 1
|
||||
detectxattronly = 1
|
||||
|
||||
topdirs = /home/dockes/projets/fulltext/testrecoll/
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
1 results
|
||||
application/x-fsdirectory [file:///home/dockes/projets/fulltext/testrecoll/emptyUniqueTerm] [emptyUniqueTerm] 4096 bytes
|
||||
inode/directory [file:///home/dockes/projets/fulltext/testrecoll/emptyUniqueTerm] [emptyUniqueTerm] 4096 bytes
|
||||
|
||||
@@ -11,6 +11,37 @@ if test ! x$reroot = x ; then
|
||||
rerootResults
|
||||
fi
|
||||
|
||||
iscmd()
|
||||
{
|
||||
cmd=$1
|
||||
case $cmd in
|
||||
*/*)
|
||||
if test -x $cmd -a ! -d $cmd ; then return 0; else return 1; fi ;;
|
||||
*)
|
||||
oldifs=$IFS; IFS=":"; set -- $PATH; IFS=$oldifs
|
||||
for d in $*;do test -x $d/$cmd -a ! -d $d/$cmd && \
|
||||
iscmdresult=$d/$cmd && return 0;done
|
||||
return 1 ;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkcmds()
|
||||
{
|
||||
result=0
|
||||
for cmd in $*;do
|
||||
if iscmd $cmd
|
||||
then
|
||||
echo $cmd is $iscmdresult
|
||||
else
|
||||
echo $cmd not found
|
||||
result=1
|
||||
fi
|
||||
done
|
||||
return $result
|
||||
}
|
||||
|
||||
checkcmds recollq recollindex pxattr xadump || exit 1
|
||||
|
||||
makeindex() {
|
||||
echo "Zeroing Index"
|
||||
rm -rf $RECOLL_CONFDIR/xapiandb $RECOLL_CONFDIR/aspdict.*.rws
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
[prefixes]
|
||||
myattr = XYXATA
|
||||
[stored]
|
||||
myattr =
|
||||
Executable
+85
@@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Test extended attributes indexing. This should work both with
|
||||
# "detectxattronly" set or unset in the config, but should be run with
|
||||
# the variable set, because we test its function by exploiting a bug
|
||||
# (see comments further)
|
||||
#
|
||||
# We use the RECOLL_CONFTOP variable to add our own fields configuration
|
||||
|
||||
thisdir=`dirname $0`
|
||||
topdir=$thisdir/..
|
||||
. $topdir/shared.sh
|
||||
|
||||
initvariables $0
|
||||
|
||||
RECOLL_CONFTOP=$thisdir
|
||||
export RECOLL_CONFTOP
|
||||
|
||||
xrun()
|
||||
{
|
||||
echo $*
|
||||
$*
|
||||
}
|
||||
|
||||
tstfile=${tstdata}/xattrs/tstxattrs.txt
|
||||
rm -f $tstfile
|
||||
|
||||
(
|
||||
# Create the file with an extended attribute, index, and query it
|
||||
# by content and field
|
||||
echo xattruniqueinfile > $tstfile
|
||||
xrun pxattr -n myattr -v xattrunique1 $tstfile
|
||||
xrun recollindex -Zi $tstfile
|
||||
echo "1 result expected"
|
||||
xrun recollq xattruniqueinfile
|
||||
echo "1 result expected"
|
||||
xrun recollq myattr:xattrunique1
|
||||
|
||||
sleep 1
|
||||
|
||||
# Change the value for the field, check that the old value is gone
|
||||
# and the new works
|
||||
xrun pxattr -n myattr -v xattrunique2 $tstfile
|
||||
xrun recollindex -i $tstfile
|
||||
echo "1 result expected"
|
||||
xrun recollq xattruniqueinfile
|
||||
echo "0 result expected:"
|
||||
xrun recollq myattr:xattrunique1
|
||||
echo "1 result expected:"
|
||||
xrun recollq myattr:xattrunique2
|
||||
|
||||
# Change the contents then the xattr. With xattronly set, recoll
|
||||
# should miss the contents change and index only the xattr. That's
|
||||
# a bug but we use it to check that pure xattr update indexing
|
||||
# works
|
||||
echo xattruniqueinfile1 > $tstfile
|
||||
sleep 2
|
||||
xrun pxattr -n myattr -v xattrunique3 $tstfile
|
||||
xrun recollindex -i $tstfile
|
||||
echo "1 result expected"
|
||||
xrun recollq xattruniqueinfile
|
||||
echo "0 result expected"
|
||||
xrun recollq xattruniqueinfile1
|
||||
echo "0 result expected:"
|
||||
xrun recollq myattr:xattrunique1
|
||||
echo "0 result expected:"
|
||||
xrun recollq myattr:xattrunique2
|
||||
echo "1 result expected:"
|
||||
xrun recollq myattr:xattrunique3
|
||||
|
||||
# Reset the index and check that the contents were seen all right
|
||||
xrun recollindex -Zi $tstfile
|
||||
echo "0 result expected"
|
||||
xrun recollq xattruniqueinfile
|
||||
echo "1 result expected"
|
||||
xrun recollq xattruniqueinfile1
|
||||
echo "0 result expected:"
|
||||
xrun recollq myattr:xattrunique2
|
||||
echo "1 result expected:"
|
||||
xrun recollq myattr:xattrunique3
|
||||
|
||||
) 2> $mystderr | egrep -v '^Recoll query: ' > $mystdout
|
||||
|
||||
diff -w ${myname}.txt $mystdout > $mydiffs 2>&1
|
||||
checkresult
|
||||
@@ -0,0 +1,57 @@
|
||||
pxattr -n myattr -v xattrunique1 /home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt
|
||||
recollindex -Zi /home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt
|
||||
1 result expected
|
||||
recollq xattruniqueinfile
|
||||
1 results
|
||||
text/plain [file:///home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt] [tstxattrs.txt] 18 bytes
|
||||
1 result expected
|
||||
recollq myattr:xattrunique1
|
||||
1 results
|
||||
text/plain [file:///home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt] [tstxattrs.txt] 18 bytes
|
||||
pxattr -n myattr -v xattrunique2 /home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt
|
||||
recollindex -i /home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt
|
||||
1 result expected
|
||||
recollq xattruniqueinfile
|
||||
1 results
|
||||
text/plain [file:///home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt] [tstxattrs.txt] 18 bytes
|
||||
0 result expected:
|
||||
recollq myattr:xattrunique1
|
||||
0 results
|
||||
1 result expected:
|
||||
recollq myattr:xattrunique2
|
||||
1 results
|
||||
text/plain [file:///home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt] [tstxattrs.txt] 18 bytes
|
||||
pxattr -n myattr -v xattrunique3 /home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt
|
||||
recollindex -i /home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt
|
||||
1 result expected
|
||||
recollq xattruniqueinfile
|
||||
1 results
|
||||
text/plain [file:///home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt] [tstxattrs.txt] 18 bytes
|
||||
0 result expected
|
||||
recollq xattruniqueinfile1
|
||||
0 results
|
||||
0 result expected:
|
||||
recollq myattr:xattrunique1
|
||||
0 results
|
||||
0 result expected:
|
||||
recollq myattr:xattrunique2
|
||||
0 results
|
||||
1 result expected:
|
||||
recollq myattr:xattrunique3
|
||||
1 results
|
||||
text/plain [file:///home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt] [tstxattrs.txt] 18 bytes
|
||||
recollindex -Zi /home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt
|
||||
0 result expected
|
||||
recollq xattruniqueinfile
|
||||
0 results
|
||||
1 result expected
|
||||
recollq xattruniqueinfile1
|
||||
1 results
|
||||
text/plain [file:///home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt] [tstxattrs.txt] 19 bytes
|
||||
0 result expected:
|
||||
recollq myattr:xattrunique2
|
||||
0 results
|
||||
1 result expected:
|
||||
recollq myattr:xattrunique3
|
||||
1 results
|
||||
text/plain [file:///home/dockes/projets/fulltext/testrecoll/xattrs/tstxattrs.txt] [tstxattrs.txt] 19 bytes
|
||||
Reference in New Issue
Block a user