[SERVER-43128] simplify FTSLanguage Created: 02/Sep/19  Updated: 29/Oct/23  Resolved: 25/Sep/19

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 4.3.1

Type: Improvement Priority: Major - P3
Reporter: Billy Donahue Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Problem/Incident
Backwards Compatibility: Fully Compatible
Sprint: Dev Tools 2019-09-09, Dev Tools 2019-09-23, Dev Tools 2019-10-07
Participants:
Linked BF Score: 90

 Description   

Currently each language makes a MONGO_INITIALIZER. This is not necessary. They can all use a single initializer. But beyond that, all languages are known in advance by fts_language.cpp so there's no need for an open registration idiom at all. This yields a massive reduction in initialization complexity for the FTSLanguage API.

The differences between versions v1, v2, and v3 are very localized. This can be expressed through templates. This is easier now in C++17 with if constexpr and variable templates. Let's upgrade to that.

remove test-only extern references:
extern BasicFTSLanguage languagePorterV1;
extern BasicFTSLanguage languageEnglishV2;
extern BasicFTSLanguage languageFrenchV2;
These are only used in tests, and they can use FTSLanguage::make like everyone else.



 Comments   
Comment by Githook User [ 25/Sep/19 ]

Author:

{'username': 'benety', 'email': 'benety@mongodb.com', 'name': 'Benety Goh'}

Message: SERVER-43128 fix windows compile
Branch: master
https://github.com/mongodb/mongo/commit/8f11dec55a066526cdef2967c763b4d23b26d636

Comment by Githook User [ 24/Sep/19 ]

Author:

{'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com', 'name': 'Billy Donahue'}

Message: SERVER-43128 include cctype for tolower
Branch: master
https://github.com/mongodb/mongo/commit/e76f54f8b6b6184dc7721a3c401e48372450cda5

Comment by Githook User [ 24/Sep/19 ]

Author:

{'name': 'Billy Donahue', 'username': 'BillyDonahue', 'email': 'billy.donahue@mongodb.com'}

Message: SERVER-43128 Simplify FTS language registry
Branch: master
https://github.com/mongodb/mongo/commit/8e35b7bc673e3bddf7049a44884d79ffb862a77d

Comment by Billy Donahue [ 02/Sep/19 ]

CR: https://mongodbcr.appspot.com/490540001/

Generated at Thu Feb 08 05:02:21 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.