Skip to content

Commit

Permalink
[no ci]fix flush
Browse files Browse the repository at this point in the history
  • Loading branch information
storytellerF committed Oct 20, 2024
1 parent 5980d25 commit 53722fb
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
1 change: 0 additions & 1 deletion backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ dependencies {
api(libs.exposed.json)
api(libs.exposed.money)
implementation(projects.shared)
implementation(libs.bcprov.jdk18on)
implementation(libs.minio)
implementation(libs.elasticsearch.java)
implementation(libs.jackson.module.kotlin)
Expand Down
3 changes: 1 addition & 2 deletions backend/src/main/kotlin/com/storyteller_f/Backend.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ private fun mediaService(map: Map<out Any, Any>): MediaService {
private fun topicDocumentService(
map: Map<out Any, Any>,
): TopicDocumentService {
val path = Paths.get("../deploy/lucene_data/index")
return when (val type = map["SEARCH_SERVICE"]) {
"elastic" -> {
val certFile = map["CERT_FILE"] as String
Expand All @@ -80,7 +79,7 @@ private fun topicDocumentService(
val pass = map["ELASTIC_PASSWORD"] as String
ElasticTopicDocumentService(ElasticConnection(url, certFile, name, pass))
}
"lucene" -> LuceneTopicDocumentService(path)
"lucene" -> LuceneTopicDocumentService(Paths.get("../deploy/lucene_data/index"))
else -> throw UnsupportedOperationException("unsupported search service type [$type]")
}
}
Expand Down
15 changes: 12 additions & 3 deletions scripts/flush-database-singleton.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ cli_path=$1
base=$2
sh $cli_path clean

# Traverse and add all JSON files from the directory
index=0

for json_file in "$base"/*.json; do
if [ -f "$json_file" ]; then
sh $cli_path add "$json_file"
filename=$(basename -- "$json_file")

file_index=$(echo "$filename" | grep -o '^[0-9]\+')

if [ "$file_index" -eq "$index" ]; then
sh "$cli_path" add "$json_file"
fi

index=$((index + 1))
fi
done
done
9 changes: 1 addition & 8 deletions scripts/flush-database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,4 @@ set -e
sh gradlew cli:installDist
cli_path=cli/build/install/cli/bin/cli
base=$1
sh $cli_path clean

# Traverse and add all JSON files from the "$base/data" directory
for json_file in "$base/data"/*.json; do
if [ -f "$json_file" ]; then
sh $cli_path add "$json_file"
fi
done
sh flush-database-singleton.sh $cli_path $base

0 comments on commit 53722fb

Please sign in to comment.