lenra-io / lenra-io/query-parser
[Task] Implement text operator
Open
Nobody has claimed this yet.
enhancement
good first issue
hacktoberfest
- Dominant language
- Elixir
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
What should be done
-
Add $text in grammar: (Check https://github.com/mongodb-js/mongodb-language-model/blob/master/grammar.pegjs for more info)
- Add
text_operator = "$text" - Uncomment
text_clauseline 42 - Implement text_clause https://github.com/mongodb-js/mongodb-language-model/blob/master/grammar.pegjs#L23
- We need to add text opêrator search/caseSensitive/diacriticSensitive
- Add
-
In exec.ex implement a function that match pos "text-clause"
- for search operator:
- split on each
spacecheck if any? match elem - if the search string contains
\, do a split on"\""and match the word/prhases on index 1 of split result
- split on each
- if case sensitive at false (true by default) do a String.downcase
- for diacriticSensitive
- true match string without traitement
- false remove accent, you can used
|> String.normalize(:nfd) |> String.replace(~r/[^A-z\s]/u, "") |> String.replace(~r/\s/, "-")
- for search operator:
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the text_operator and text_clause definitions in grammar.pegjs, then inspect exec.ex for the matching point named "text-clause". Implement search handling with quoted phrases, case sensitivity, and diacritic sensitivity, and consider the task complete when all listed text-operator behaviors are supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- backend, search
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100