Skip to content

Commit

Permalink
Migration de ElasticSearch à Typesense (#6475)
Browse files Browse the repository at this point in the history
Co-authored-by: Thibaut Lanier <thibaut.lanier@gmail.com>
Co-authored-by: Naël De Luca <ndeluca@bordeaux-inp.fr>
Co-authored-by: Philippe MILINK <philippe.milink@gmx.fr>
  • Loading branch information
4 people authored Sep 25, 2024
1 parent 15b4c43 commit 9a2d086
Show file tree
Hide file tree
Showing 66 changed files with 3,331 additions and 3,166 deletions.
28 changes: 9 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ env:
PYTHON_VERSION: "3.9"
MARIADB_VERSION: "10.4.10"
COVERALLS_VERSION: "3.3.1" # check if Coverage needs to be also updated in requirements-ci.txt
TYPESENSE_VERSION: "27.0" # needs to be also updated in scripts/define_variable.sh

# As GitHub Action does not allow environment variables
# to be used in services definitions, these are only for
# reference. If you update these versions, you HAVE TO
# update the versions in the services definitions of the
# test job.
ELASTICSEARCH_VERSION: "5.5.2"
MEMCACHED_VERSION: "1.6"

jobs:
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:

# Test the zds-site project.
# Install the project, using assets created during the previous job,
# and install elasticsearch & memcache as a service. Then, run the tests
# and install Typesense & Memcached as a service. Then, run the tests
# in a matrix build to parallelize multiple components.
test:
name: Install and test zds-site
Expand All @@ -144,27 +144,11 @@ jobs:
module:
[
"zds.tutorialv2",
"zds.member zds.gallery zds.searchv2 zds.middlewares zds.pages",
"zds.member zds.gallery zds.search zds.middlewares zds.pages",
"zds.forum zds.featured zds.mp zds.notification zds.utils",
]

services:
elasticsearch:
image: "elasticsearch:5.5.2"
ports:
- "9200:9200"
env:
"http.host": "0.0.0.0"
"transport.host": "127.0.0.1"
"xpack.security.enabled": false
"ES_JAVA_OPTS": "-Xms512m -Xmx512m"
options: >-
-e="discovery.type=single-node"
--health-cmd="curl http://localhost:9200/_cluster/health"
--health-interval=10s
--health-timeout=5s
--health-retries=10
memcached:
image: "memcached:1.6"
ports:
Expand All @@ -183,6 +167,12 @@ jobs:
mysql database: "ci_db_name"
mysql root password: "ci_root_password"

- name: Start Typesense
uses: jirevwe/typesense-github-action@v1.0.1
with:
typesense-version: ${{ env.TYPESENSE_VERSION }}
typesense-api-key: xyz

- name: Checkout
uses: actions/checkout@v4

Expand Down
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,16 @@ zmd-stop: ## Stop the zmarkdown server
node ./zmd/node_modules/pm2/bin/pm2 kill

##
## ~ Elastic Search
## ~ Search Engine

run-elasticsearch: ## Run the Elastic Search server
elasticsearch || echo 'No Elastic Search installed (you can add it locally with `./scripts/install_zds.sh +elastic-local`)'
run-search-engine: ## Run the search server
./.local/typesense/typesense-server --data-dir=.local/typesense/typesense-data --api-key=xyz || echo 'No Typesense installed (you can add it locally with `./scripts/install_zds.sh +typesense-local`)'

index-all: ## Index the database in a new Elastic Search index
python manage.py es_manager index_all
index-all: ## Index the whole database in the search engine
python manage.py search_engine_manager index_all

index-flagged: ## Index the database in the current Elastic Search index
python manage.py es_manager index_flagged
index-flagged: ## Index new content in the search engine
python manage.py search_engine_manager index_flagged

##
## ~ PDF
Expand Down
4 changes: 4 additions & 0 deletions assets/scss/base/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ nav {
}
}

.align-center {
text-align: center;
}

@include desktop {
body {
min-height: 100%;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
============================
La recherche (``searchv2/``)
La recherche (``search/``)
============================

Module situé dans ``zds/searchv2/``.
Module situé dans ``zds/search/``.

.. contents:: Fichiers documentés :

Modèles (``models.py``)
=======================

.. automodule:: zds.searchv2.models
.. automodule:: zds.search.models
:members:

Vues (``views.py``)
===================

.. automodule:: zds.searchv2.views
.. automodule:: zds.search.views
:members:
Loading

0 comments on commit 9a2d086

Please sign in to comment.