https://github.com/geoadmin/service-search-sphinx
Sphinx Search service for RE3
https://github.com/geoadmin/service-search-sphinx
managed-by-tf re3 service-search
Last synced: 4 months ago
JSON representation
Sphinx Search service for RE3
- Host: GitHub
- URL: https://github.com/geoadmin/service-search-sphinx
- Owner: geoadmin
- License: other
- Created: 2013-08-22T12:40:38.000Z (almost 13 years ago)
- Default Branch: develop-2025-05-14
- Last Pushed: 2025-04-02T14:19:35.000Z (about 1 year ago)
- Last Synced: 2025-04-02T14:27:15.846Z (about 1 year ago)
- Topics: managed-by-tf, re3, service-search
- Language: Python
- Homepage:
- Size: 1.31 MB
- Stars: 7
- Watchers: 25
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
service-sphinxsearch
====================
Sphinx Search service for RE3
---------------------------------------------------
### SPHINX doc (2.2.11):
- http://sphinxsearch.com/docs/
- http://sphinxsearch.com/docs/current.html
- http://sphinxsearch.com/docs/archives/2.1.5/
### Setup
The fsdi sphinxsearch consists of the following services:
* [service-search-wsgi](https://github.com/geoadmin/service-search-wsgi) (port 80)
* [service-sphinxsearch](https://github.com/geoadmin/service-sphinxsearch) (port 9312)
The service configuration is in this [docker-compose](https://github.com/geoadmin/infra-vhost/blob/master/systems/api3/service-search/base/docker-compose.yml) file:
### service-search-wsgi adresses
Staging | URL
-----------------|------------------------------------------|
**Dev:** | https://sys-api3.dev.bgdi.ch/rest/services/api/SearchServer |
**Int:** | https://sys-api3.int.bgdi.ch/rest/services/api/SearchServer |
**Prod:** | https://api.geo.admin.ch/rest/services/api/SearchServer |
### service-sphinxsearch container setup
The sphinxsearch container/image can be operated in
* **maintenance mode** (index creation / update)
* **service mode** (sphinxsearch service on port 9312)
### Service paths inside the running container
Object | Path
------------------|-----------------------------------|
**PID:** | /var/run/sphinxsearch/searchd.pid |
**Searchd Log** | /var/log/sphinxsearch/searchd.log |
**Query Log:** | /var/log/sphinxsearch/query.log |
**Indexes:** | /var/lib/sphinxsearch/data/index/ |
**Configuration:**| /etc/sphinxsearch/sphinx.conf |
### maintenance mode
#### local index config validation
```bash
make check-config-local
```
This check is automatically executed with Codebuild for each Pull request.
#### local index creation
```bash
STAGING=dev DB=bod_dev make pg2sphinx
```
For this command you need read-write access to `${SPHINX_EFS}`.
This command is executed/triggered by the database deploy script on `geodatasync.prod.bgdi.ch`.
### service mode
#### local sphinxsearch server
You can run a local sphinxsearch server on port 9312 with the following make targets:
```bash
make dockerrun
make dockerrundebug
```
the initial start of this local container will copy all the index files from the efs folder to a local docker volume. This initial ramp up process can take up to an hour! You will need at least **70 GB of free diskspace** on your host.
In the running service container, the indexes are synced every 15 minutes from efs to the local volume and rotated. This is done with the script index-sync-rotate.sh.
The sphinxsearch logs (searchd and query logs) and the index-sync-rotate.sh logs are redirected to stdout inside the container and are visible with `docker logs`.
### Deploy
Since the service is operated on vhosts, the deploy of the search stack (service-search-wsgi and service-sphinxsearch) is done with this [deploy script](https://github.com/geoadmin/infra-vhost/blob/master/deploy.sh).
See [here](https://github.com/geoadmin/doc-guidelines/blob/master/DEPLOY.md#1-sphinx-search---int) for more information.
### Wordform
Wordforms are part of the sphinx conf.
The swisssearch index (zipcodes) has to be computed after a wordforms update.
### Command line debugging with python sphinx api
```bash
cd test
python test.py -h localhost -p 9312 -i swisssearch "birgmattenweg 5"
```