objectbox / objectbox/objectbox-java

Combine Query links with or()

Open
#497 15 comments 27 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

@Entity
public class Note {
    @Id public long id;
    public String title; 
    public ToMany<Tag> tags;
}
 
@Entity
public class Tag {
    @Id public long id;
    public String description;
    public String description2;
}

How to query and return all the results that match the query entered by the user?

noteBox.query()
   .equal(Note_.title, queryString)
  .link(Note_.tags)
   .or()
  .equal(Tag_.description, queryString)
   .or()
  .equal(Tag_.description2, queryString)
  .build()
  .find();

Not working

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 noteBox.query() chain in the issue, especially the link(Note_.tags) and or() calls. Reproduce the query against the Note and Tag entities using the supplied fields, then determine the expected combined results and verify the behavior with a focused query test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.