Skip to content

Commit

Permalink
repopulate new index 1 with language titles for sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
emgeier authored Nov 20, 2024
1 parent efef676 commit 2b721f1
Showing 1 changed file with 24 additions and 25 deletions.
49 changes: 24 additions & 25 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,10 @@ jobs:

- name: Specify specific XML files and 25 per category
run: |
# find ./data/persons/tei -name '*.xml' | head -n 25 > xml_files.txt
# find ./data/places/tei -name '*.xml' | head -n 25 >> xml_files.txt
# find ./data/works/tei -name '*.xml' | head -n 25 > xml_files.txt
find ./data/bibl/tei -name '*.xml' | head -n 25 > xml_files.txt
find ./data/persons/tei -name '*.xml' | head -n 25 > xml_files.txt
find ./data/places/tei -name '*.xml' | head -n 25 >> xml_files.txt
find ./data/works/tei -name '*.xml' | head -n 25 >> xml_files.txt
find ./data/bibl/tei -name '*.xml' | head -n 25 >> xml_files.txt
find ./data/subjects/tei -name '*.xml' | head -n 25 >> xml_files.txt
echo "./data/persons/tei/25.xml" >> xml_files.txt
Expand Down Expand Up @@ -120,7 +119,7 @@ jobs:
# Extract the filename and create the index header for OpenSearch bulk format
filename=$(basename ${file%.xml})
echo "Processing $filename for JSON"
printf "{\"index\":{\"_index\":\"syriaca-index-6\",\"_id\":\"$type-$filename\"}}\n" >> bulk_data.json
printf "{\"index\":{\"_index\":\"syriaca-index-1\",\"_id\":\"$type-$filename\"}}\n" >> bulk_data.json

# Apply XSLT for JSON conversion and append it to bulk_data.json directly
java -jar saxon.jar -s:$file -xsl:json-stylesheet.xsl docType="$type" | tr -d '\n' >> bulk_data.json
Expand Down Expand Up @@ -167,7 +166,7 @@ jobs:
# Step 7: Upload files to S3
- name: Upload JSON file to S3
run: |
aws s3 cp bulk_data.json s3://srophe-syriaca-front-end/json-data/advancedsearchfields/bulk_data_index_6.json
aws s3 cp bulk_data.json s3://srophe-syriaca-front-end/json-data/advancedsearchfields/bulk_data_index_1.json
env:
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
Expand Down Expand Up @@ -195,23 +194,23 @@ jobs:

# Step 8: Upload JSON data to OpenSearch

# - name: JSON file to OpenSearch
- name: JSON file to OpenSearch

# env:
# OPENSEARCH_URL: ${{ secrets.OPENSEARCH_URL }}
# OPENSEARCH_USER: ${{ secrets.OPENSEARCH_USER }}
# OPENSEARCH_PASSWORD: ${{ secrets.OPENSEARCH_PASSWORD }}
# run: |
# RESPONSE=$(curl -s -o response.json -w "%{http_code}" -XPOST "$OPENSEARCH_URL/_bulk" \
# -H "Content-Type: application/json" \
# -u "$OPENSEARCH_USER:$OPENSEARCH_PASSWORD" \
# --data-binary "@bulk_data.json")
# echo "HTTP response code: $RESPONSE"
# cat response.json

# # Check for errors in the response
# if grep -q '"errors":true' response.json; then
# echo "Errors occurred during bulk upload"
# exit 1
# fi
env:
OPENSEARCH_URL: ${{ secrets.OPENSEARCH_URL }}
OPENSEARCH_USER: ${{ secrets.OPENSEARCH_USER }}
OPENSEARCH_PASSWORD: ${{ secrets.OPENSEARCH_PASSWORD }}
run: |
RESPONSE=$(curl -s -o response.json -w "%{http_code}" -XPOST "$OPENSEARCH_URL/_bulk" \
-H "Content-Type: application/json" \
-u "$OPENSEARCH_USER:$OPENSEARCH_PASSWORD" \
--data-binary "@bulk_data.json")
echo "HTTP response code: $RESPONSE"
cat response.json
# Check for errors in the response
if grep -q '"errors":true' response.json; then
echo "Errors occurred during bulk upload"
exit 1
fi

0 comments on commit 2b721f1

Please sign in to comment.