Skip to content
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

Tags for RecordsWrite and for filters within RecordsQuery #650

Closed
wants to merge 9 commits into from

Conversation

LiranCohen
Copy link
Member

@LiranCohen LiranCohen commented Dec 22, 2023

This is a first pass at adding the functionality for tags within records as mentioned here #642.

Need to implement size limits for tags, additional tests, and pepper with comments.

Additionally tags are not able to be used as a sort property, right now it returns zero results (as other invalid sort properties would).

Tags are written to records as follows:

{
    published : true,
    schema    : 'post',
    tags      : {
      tag1 : [ 'tag1', 'tag2', 'tag3' ],
      tag2 : [ 1, 2, 3 ],
      tag3 : [ true ]
    }
}

// OneOf match tag
Filters as follows:

{
  filter : {
    tags: {
      tag1: 'tag2'
    }
  }
}

OneOf match boolean

{
  filter : {
    tags: {
      tag3: true
    }
  }
}

// OneOf match numeric

 {
   filter : {
      tags: {
        tag2: 2
      }
    }
 }

// numerical match range

 {
   filter : {
      tags: {
        gt : 2,
        lt : 4,
      }
    }
 }

// string match range, can be used for date strings.

 {
   filter : {
      tags: {
        tag1: {
          from : 'tag2',
          to   : 'tag4'
        }
      }
    }
 }

Test case to look at: should be able to query by string tags

Copy link

codesandbox bot commented Dec 22, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@codecov-commenter
Copy link

codecov-commenter commented Dec 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8b81c97) 98.83% compared to head (4813120) 98.84%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #650      +/-   ##
==========================================
+ Coverage   98.83%   98.84%   +0.01%     
==========================================
  Files          71       71              
  Lines        9243     9372     +129     
  Branches     1391     1419      +28     
==========================================
+ Hits         9135     9264     +129     
  Misses        100      100              
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LiranCohen LiranCohen changed the title Tags for RecordsWrite and for RecordsQuery Tags for RecordsWrite and for filters within RecordsQuery Dec 22, 2023
@LiranCohen
Copy link
Member Author

Closing in favor if: #706

@LiranCohen LiranCohen closed this Mar 14, 2024
@LiranCohen LiranCohen deleted the lirancohen/tags branch March 14, 2024 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants