You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
1.7 KiB

#!/bin/bash
MEILISEARCH_URL=http://localhost:7700
INDEXNAME=notes
# true << DROP
echo "DROP"
curl -s -X DELETE "${MEILISEARCH_URL}/indexes/${INDEXNAME}/documents"
echo
sleep 5
# DROP
# true << CREATE
echo "CREATE"
curl -s -X POST "${MEILISEARCH_URL}/indexes" -H "Content-Type: application/json" --data-binary "{
\"uid\": \"${INDEXNAME}\",
\"primaryKey\": \"id\"
}"
echo
sleep 5
# CREATE
# true << UPDATE_SETTINGS
echo "UPDATE SETTINGS"
curl -s -X PATCH "${MEILISEARCH_URL}/indexes/${INDEXNAME}/settings" -vvv -H 'Content-Type: application/json' --data-binary '{
"rankingRules": [
"words",
"typo",
"proximity",
"attribute",
"exactness",
"refcount:desc",
"changed:desc",
"created:desc"
],
"filterableAttributes": [
"tags"
],
"displayedAttributes": [
"title",
"tags",
"type",
"created",
"changed",
"id",
"body",
"image",
"refcount",
"headerlines"
],
"searchableAttributes": [
"tags",
"description",
"title",
"body"
],
"sortableAttributes": [
"refcount",
"changed",
"created"
],
"distinctAttribute": "id",
"stopWords": null
}'
echo
sleep 5
# UPDATE_SETTINGS
# true << UPDATE_NOTES
~/bin/updateNotes.sh all
echo
sleep 5
# UPDATE_NOTES
#<< SHOW_SETTINGS
echo "SHOW SETTINGS"
curl -s -X GET 'http://localhost:7700/indexes/notes/settings'| jq
echo
#SHOW_SETTINGS
# << SHOW_STATS
echo "Neorg and Markdown files found in notes folder: $(ls -1 | grep -e ".*[.]\(norg\|md\)$"| wc -l)"
echo
echo "SHOW STATS"
curl -s 'http://localhost:7700/indexes/notes/stats'| jq
echo
INDEXNAME="456"
# SHOW_STATS
# << GET_UPDATES
echo "GET UPDATES"
curl -s 'http://localhost:7700/indexes/notes/updates/'| jq
echo
# GET_UPDATES