-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DAT-70] feat: Do not use flexsearch store #2623
base: master
Are you sure you want to change the base?
Conversation
Flexsearch has a built-in store capability, in order to store the full content of indexed documents. This is useful, however, this takes extra memory for nothing, as we already have the cozy-client store. All the indexed documents for the search are supposed to exist in cozy-client store, as we query them from Pouch at init, and retrieve updates from realtime, already plugged in cozy-client.
/* | ||
Search result example: | ||
[ | ||
{ | ||
"field": "displayName", | ||
"result": [ | ||
"604627c6bafee013ec5f27f7f72029f6" | ||
] | ||
}, | ||
{ | ||
"field": "fullname", | ||
"result": [ | ||
"604627c6bafee013ec5f27f7f72029f6", "604627c6bafee013ec5f27f3f714568" | ||
] | ||
} | ||
] | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was that comment expected to be commited?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it was, it does not look like a good practice, but I honestly felt like it was helpful to better grasp the expected result quickly
@@ -179,14 +180,13 @@ export class SearchEngine { | |||
const fieldsToIndex = SEARCH_SCHEMA[doctype] | |||
|
|||
const flexsearchIndex = new FlexSearch.Document<CozyDoc, true>({ | |||
tokenize: 'forward', | |||
tokenize: 'full', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this change is not documented in the commit message and is not part of the "do not use flexsearch store" scope. Maybe you can add some precision in the commit message or extract it in another commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my, it's a mistake, thank you!
Flexsearch has a built-in store capability, in order to store the full content of indexed documents.
This is useful, however, this takes extra memory for nothing, as we already have the cozy-client store. All the indexed documents for the search are supposed to exist in cozy-client store, as we query them from Pouch at init, and retrieve updates from realtime, already plugged in cozy-client.