dhilt / dharmadict

MIT License
1 stars 2 forks source link

Search by "sanskrit_ru" field don't work #51

Open dhilt opened 4 years ago

dhilt commented 4 years ago

Scenario 1.

Input "васана" which is present in the Terms table (here). Despite "васана" is the value of "sanskrit_ru" filed of the "bag chags" term, the search result is empty.

Screenshot 2020-05-26 at 19 28 21

Scenario 2.

Input "атман" which is present in the Terms table twice (here and here). So "bdag" and "bdag nyid" are the terms we want to have is the search results (they both have "атман" in "sanskrit_ru"). But there is only "bdag" term in the result due to "атман" is a part of the translations data of this term.

Screenshot 2020-05-26 at 19 27 30

Requirements.

Currently the search engine uses sanskrit fields as well as id and translations fields

https://github.com/dhilt/dharmadict/blob/c37ce7ab6e17616c3a3ef8f356092e0b8b1e83b8/prod/controllers/terms.js#L88-L97

We need to check out what's wrong with the value of "sanskrit_rus_lower" field at the DB level. Perhaps the terms taken and exported from CSV files don't have "sanskrit_rus_lower" and "sanskrit_eng_lower" fields. In this case we need to add new migration script and fix all existed terms.

Also, I believe the terms that are being created via web interface should be fine due to

https://github.com/dhilt/dharmadict/blob/c37ce7ab6e17616c3a3ef8f356092e0b8b1e83b8/prod/controllers/validators/terms.js#L29-L35

but this also needs to be double checked.