mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-25 18:44:23 +00:00
Miroir du site de l'AE UTBM
https://ae.utbm.fr
782cd9a45a
Sexy search The goal of this MR is to solve the search issue #96. Let's assume we have a user with firstname `Jean-François`, lastname `Du Pont` and nickname `Ai'gnan`. Here is a list of search that did not include him previously but now includes him (was and still is case-insensitive): * `jean françois` (missing -) ; * `jean-francois` (missing ç) ; * `jean francois` (both) ; * `dupont` (space) ; * `françois` (not the start of his name) ; * `aignan` (missing '). You get it, there are a lot of mistakes that humans can do. It also sorts results by `User.last_update` to avoid putting old accounts at the top of common requests (such as firstname-only or lastname-only requests). ### How it works For those who don't know, the search is handled by Xapian (the search backend) through the haystack library which provides a Django-friendly interface to multiple search backends. Xapian maintains kind of a duplicate of the database (only for models against which we want to search something) which is optimised for search operations. Its "models" are called "indexes" (see `core.search_indexes.UserIndex` for the user model). Every time a user is created or modified, it is indexed (through a signal handler) so that Xapian knows about it. For the user search, what is indexed is the string outputted by the `core/templates/search/indexes/core/user_auto.txt` template. For our example from above, it looks like this: ``` jean francois du pont aignan jeanfrancois dupont jeanfrancoisdupont ``` As you can see, unicode is removed. There also are kind-of duplicates with different spacing as we are using an autocomplete algorithm: it searches from the beginning of words. The one I am not sure about is the last one. Its goal is to allow searching without putting a space between the firstname and lastname. Is this useful? The prod will have to do a `./manage.py update_index`, not sure it does it in the upgrade script. See merge request ae/Sith!269 |
||
---|---|---|
accounting | ||
api | ||
club | ||
com | ||
core | ||
counter | ||
doc | ||
eboutic | ||
election | ||
forum | ||
launderette | ||
locale/fr/LC_MESSAGES | ||
matmat | ||
pedagogy | ||
rootplace | ||
sas | ||
sith | ||
stock | ||
subscription | ||
trombi | ||
.coveragerc | ||
.envrc | ||
.gitattributes | ||
.gitignore | ||
.gitlab-ci.yml | ||
.readthedocs.yml | ||
CONTRIBUTING.rst | ||
LICENSE | ||
LICENSE.old | ||
manage.py | ||
migrate.py | ||
README.rst | ||
requirements.txt |
.. image:: https://ae-dev.utbm.fr/ae/Sith/badges/master/pipeline.svg :target: https://ae-dev.utbm.fr/ae/Sith/commits/master :alt: pipeline status .. image:: https://readthedocs.org/projects/sith-ae/badge/?version=latest :target: https://sith-ae.readthedocs.io/?badge=latest :alt: documentation Status .. image:: https://ae-dev.utbm.fr/ae/Sith/badges/master/coverage.svg :target: https://ae-dev.utbm.fr/ae/Sith/commits/master :alt: coverage report .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/ambv/black :alt: code style: black .. image:: https://img.shields.io/badge/zulip-join_chat-brightgreen.svg :target: https://ae-dev.zulipchat.com :alt: project chat This is the source code of the UTBM's student association available at https://ae.utbm.fr/. All documentation is in the ``docs`` directory and online at https://sith-ae.readthedocs.io/. This documentation is written in French because it targets a French audience and it's too much work to maintain two versions. The code and code comments are strictly written in English. If you want to contribute, here's how we recommend to read the docs: * First, it's advised to read the about part of the project to understand the goals and the mindset of the current and previous maintainers and know what to expect to learn. * If in the first part you realize that you need more background about what we use, we provide some links to tutorials and documentation at the end of our documentation. Feel free to use it and complete it with what you found helpful. * Keep in mind that this documentation is thought to be read in order. To join our team : * Send a mail at mailto:ae.utbm.fr * Join our group chat at https://ae-dev.zulipchat.com * See and join our Trello at https://trello.com/b/YQOaF33m/site-ae. This project is licenced under GNU GPL, see the LICENSE file at the top of the repository for more details.