objectbox / objectbox/objectbox-java

ability to link queries with OR not just AND

Open
#1,223 1 comment 4 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

Use case

I have a DB where EntryA has one-to-many relationships with EntryB.
I encountered a case where I have a text field, and I want to query the EntryA database to retrieve all entries filtered by that text field's value.
So for value 'aa', I want to get all the EntryA values where EntryA.name contains 'aa' OR(not AND, which is the default) if EntityA.items contain items with name containing 'aa'

Code example


        final builder =
            store.box<EntryA>().query(EntryA_.name.contains('aa'))
              ..link(EntryA_.owner, Owner_.id.equals(123))
              ..backlink(EntryB_.parent, EntryB_.name.contains('bb'));

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 from the query entry point store.box<EntryA>().query(...) and inspect how the shown link and backlink constraints are combined. Define how an OR between EntryA.name.contains('aa') and matching related items should work, then verify the behavior with a focused query example. Done means queries can express the requested OR relationship instead of applying only AND semantics.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.