diff --git a/Dockerfile b/Dockerfile index b6cbd75..8fdac0c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM golang:1.18.1-alpine -RUN apk add git bash curl poppler-utils gcc musl-dev xmlstarlet libxml2-utils +RUN apk add git bash curl poppler-utils gcc musl-dev xmlstarlet parallel libxml2-utils # build WORKDIR /app diff --git a/indexCorpus.sh b/indexCorpus.sh index 19b9727..e306f03 100644 --- a/indexCorpus.sh +++ b/indexCorpus.sh @@ -35,10 +35,12 @@ fi fullPath=$1 analysisType=$2 +corpusPath=$3 #Check if $fullPath exists if [ -f $fullPath ] then + outPath=`dirname $fullPath` #extract json file name from path" fileName=$(echo $fullPath | awk -F "/" '{print $NF}') #check if json file = $filePattern @@ -98,6 +100,10 @@ echo "Unexpected file name : "$fileName" instead of "$filePattern exit fi + # Generation xpaths.csv avec les valeurs des attributs + echo "" + echo "Generation xpaths.csv avec les valeurs des attributs" + find $corpusPath -name *.xml | parallel --silent xmlstarlet el -v {} 2>/dev/null \; | sort | uniq -c > $outPath/xpaths.csv else echo "File is missing" exit diff --git a/main.go b/main.go index 99fe6a0..7b7057a 100644 --- a/main.go +++ b/main.go @@ -202,7 +202,7 @@ // after process index analyze file if !*noIndexation { log.Println(color.InBlue("Run indexation process")) - result, err := exec.Command("/bin/bash", "indexCorpus.sh", logPath+"/analyse-logs.json", importType).CombinedOutput() + result, err := exec.Command("/bin/bash", "indexCorpus.sh", logPath+"/analyse-logs.json", importType, *corpusPath).CombinedOutput() if err != nil { fmt.Println(color.InRed("Error indexCorpus.sh")) }