objectbox / objectbox/objectbox-java

Queries: Support "notIn" with string arrays like "in" does

Open
#941 1 comment 10 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
4.6k
Forks
311
PR merge metrics
No merged PRs in 30d

Description

On queries, you can use string array "overloads" for in in the following ways:
QueryBuilder<T> in(Property<T> property, String[] values)
QueryBuilder<T> in(Property<T> property, String[] values, StringOrder order)

The same "overloads" are not supported for notIn though, which only supports int and long arrays

image

Edit: additional suggestions via #1129:

  • Implement doesNotContain, doesNotEndWith, doesNotStartWith into Property or
  • Create QueryCondition.not() that would allow to negate any given QueryCondition

Example use case for the latter :

Character_.lastName.equal("lannister", QueryBuilder.StringOrder.CASE_INSENSITIVE)
.and(Character_.firstName.startsWith("ty", QueryBuilder.StringOrder.CASE_INSENSITIVE)) // "Tywin", "Tyrion", "Tytos"

Character_.lastName.equal("lannister", QueryBuilder.StringOrder.CASE_INSENSITIVE)
.and(Character_.firstName.startsWith("ty", QueryBuilder.StringOrder.CASE_INSENSITIVE).not()) // "Cersei", "Jaime", "Lancel"

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 with the QueryBuilder and Property query APIs named in the issue, comparing the existing string-array in overloads with the int- and long-array notIn overloads. Trace the related query tests, then confirm that string-array notIn supports the same overload forms and behavior as in.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.