Closed gbubemismith closed 2 years ago
Wasn't this already merged in #812?
Wasn't this already merged in #812?
Yeah it was but I discovered a bug when I moved the normalisation to a private method. The lunr pipeline function can't access methods outside it's scope.
We could just a private internal function in the file and use it?
do you mean like a private normalizeQuery function and then call the function with this.normalizeQuery
in the pipeline function???
Yes, just moving normalizeQuery
to be a top level function. That should keep it accessible in the lunr pipeline (or so I assume).
Yes, just moving
normalizeQuery
to be a top level function. That should keep it accessible in the lunr pipeline (or so I assume).
Moved it to the utils class
Utils
is a bit of a miscellaneous class, we shouldn't add to it if we can avoid it.I would recommend just making
normalizeSearchQuery
a public method onSearchService
, will that work for lunr? Or if it needs to be static, make it static onSearchService
. You can do either without moving it toUtils
.@Hinton I don't quite understand your feedback, is this what you were suggesting?
made it a static method in SearchService
@eliykat I'm fine with static on SearchService. My initial thought was to create a function outside the class in the same file. Javascript isn't locked to OOO and we can diverge if needed.
Type of change
Objective
Code changes
common/src/services/search.service.ts: referenced utils class and changed normalizeSearchQuery call to use the utils method.
common/src/misc/utils.ts: moved
normalizeSearchQuery
here so it can be accessed bylunr
pipeline function.Before you submit
npm run lint
) (required)