lenra-io / lenra-io/query-parser

[Task] Implement text operator

Open
#25 0 comments 0 reactions 0 assignees View on GitHub

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)

  • In exec.ex implement a function that match pos "text-clause"

    • for search operator:
      • split on each space check if any? match elem
      • if the search string contains \, do a split on "\"" and match the word/prhases on index 1 of split result
    • 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/, "-")

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.