Skip to content

Commit 9cab11a

Browse files
committed
Start setup for search index in CI
1 parent 7d2aee1 commit 9cab11a

3 files changed

Lines changed: 32 additions & 58 deletions

File tree

.github/workflows/develop.yml

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,40 @@ on:
66
- "develop"
77

88
jobs:
9-
clippy:
9+
build-search-index:
10+
name: "Build search index"
1011
runs-on: ubuntu-latest
1112
steps:
1213
- uses: actions/checkout@v2
13-
- name: Install toolchain
14-
run: rustup toolchain install stable
15-
- name: Install clippy
16-
run: rustup component add clippy
17-
- name: Run clippy
14+
- uses: prefix-dev/setup-pixi@v0.9.2
15+
with:
16+
run-install: false
17+
- name: Configure SSH
1818
run: |
19-
cd backend-rust
20-
cargo clippy --all-targets --all-features -- -D warnings
19+
mkdir -p ~/.ssh/
20+
echo "$SSH_KEY" > ~/.ssh/prod.key
21+
chmod 600 ~/.ssh/prod.key
22+
cat >>~/.ssh/config <<END
23+
Host prod
24+
HostName $SSH_HOST
25+
User $SSH_USER
26+
IdentityFile ~/.ssh/prod.key
27+
StrictHostKeyChecking no
28+
END
29+
env:
30+
SSH_USER: ${{ secrets.SSH_USERNAME }}
31+
SSH_KEY: ${{ secrets.SSHKEY }}
32+
SSH_HOST: ${{ secrets.HOST }}
2133

22-
test:
23-
runs-on: ubuntu-latest
24-
steps:
25-
- uses: actions/checkout@v2
26-
- name: Run tests
34+
- name: Download index data
2735
run: |
28-
cd backend-rust
29-
./download_test_data.sh
30-
cargo test --all-targets
31-
32-
docker:
33-
runs-on: ubuntu-latest
34-
steps:
35-
- name: Set up Docker Buildx
36-
uses: docker/setup-buildx-action@v2
37-
- name: Login to Docker Hub
38-
uses: docker/login-action@v2
39-
with:
40-
username: ${{ secrets.DOCKERHUB_USERNAME }}
41-
password: ${{ secrets.DOCKERHUB_TOKEN }}
42-
- name: Build docker image
43-
uses: docker/build-push-action@v4
44-
with:
45-
push: true
46-
tags: hoff97/hikeandfly:develop
47-
cache-from: type=registry,ref=hoff97/hikeandfly:develop
48-
cache-to: type=inline
36+
mkdir -p search_preprocess/data
37+
cd search_preprocess/data
38+
../download_data.sh | awk 'NR % 1000 == 1'
39+
ls -lh
40+
- name: Build search index
41+
run: |
42+
cd search_preprocess
43+
pixi run python preprocess_search_data.py
44+
pixi run python filter_search_data.py
45+
pixi run python preprocess_flying_site_data.py

search_preprocess/download_data.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
wget https://download1.graphhopper.com/public/europe/austria/photon-dump-austria-0.7-latest.jsonl.zst
2-
wget https://download1.graphhopper.com/public/europe/italy/photon-dump-italy-0.7-latest.jsonl.zst
3-
wget https://download1.graphhopper.com/public/europe/germany/photon-dump-germany-0.7-latest.jsonl.zst
4-
wget https://download1.graphhopper.com/public/europe/france-monacco/photon-dump-france-monacco-0.7-latest.jsonl.zst
5-
wget https://download1.graphhopper.com/public/europe/slovenia/photon-dump-slovenia-0.7-latest.jsonl.zst
62

73
zstd -d photon-dump-*.jsonl.zst
84

95
wget https://service.dhv.de/dbfiles/managed/gelaendedaten/dhvxml/dhvgelaende_dhvxml_alle.zip?format=dhvxml&land=alle&nutzung=on
10-
unzip unzip dhvgelaende_dhvxml_alle.zip\?format=dhvxml\&land=alle\&nutzung=on
6+
unzip unzip dhvgelaende_dhvxml_alle.zip\?format=dhvxml\&land=alle\&nutzung=on

search_preprocess/src/preprocess_search_data.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -210,26 +210,7 @@ def preprocess_data():
210210
else:
211211
raise ValueError(f"Unsupported object type: {object_data['type']}")
212212

213-
c = list(categories.items())
214-
c.sort(key=lambda x: x[1], reverse=True)
215-
print(f"Found categories: {c}")
216-
categories_contained_once = [k for k, v in categories.items() if v == 1]
217-
218-
second_level = defaultdict(int)
219-
for name, count in categories.items():
220-
splitted = name.split(".")
221-
second_level[".".join(splitted[:2])] += count
222-
sl = list(second_level.items())
223-
sl.sort(key=lambda x: x[1], reverse=True)
224-
print(f"Found categories: {sl}")
225-
226213
df = pl.DataFrame(result)
227-
df = df.filter(
228-
pl.col("categories")
229-
.list.set_intersection(categories_contained_once)
230-
.list.len()
231-
== 0
232-
)
233214
print(df)
234215
df.write_ndjson(f"data/augmented_search_data_{region}.jsonl")
235216
df = df.drop("categories")

0 commit comments

Comments
 (0)