Further develop example.sh

This commit is contained in:
Josh Hansen 2023-08-08 18:05:10 -07:00
parent 87a7550558
commit 2351b3e013
2 changed files with 27 additions and 2 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
/target
publish.sh
yank.sh
example/

View file

@ -1,8 +1,32 @@
#!/bin/sh
# Generates example dataset
# Generates example dataset and does some stuff
mkdir ./people
if [ ! -d "example" ]; then
mkdir example
fi
cd example
# Create a personnel dataset with three people
# The name, ID, and state of residence are known for each person
mkdir people
touch ./people/Sandeep ./people/Sofia ./people/Wulfrum
mtr set -s name=Sandeep -s id=2 -s state=CA ./people/Sandeep
mtr set -s name=Sofia -s id=1 -s state=WA ./people/Sofia
mtr set -s name=Wulfrum -s id=0 -s state=CA ./people/Wulfrum
# Index the dataset by ID
mtr idx -v -k id ./people ./people:id
# Index the dataset by state and ID
mtr idx -v -k state -k id ./people ./people:state:id
# Get the name of everybody from California
mtr get -w state=CA -f name ./people
# Get the name of everybody from California, taking advantage of the state index
# This will avoid traversing irrelevant portions of the index
mtr get -w state=CA -f name ./people:state:id
cd ..