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

Cannot search for strings containing double quotes #7

Open
badaz opened this issue Mar 16, 2018 · 0 comments
Open

Cannot search for strings containing double quotes #7

badaz opened this issue Mar 16, 2018 · 0 comments

Comments

@badaz
Copy link

badaz commented Mar 16, 2018

When using contains(), it is not possible to have search terms containing double quotes. The error is "Invalid predicate". I had to stop using the lib to have my query work.

Not working with realm-query:

items = RealmQuery
        .where(realmStorageManager.getRealm().objects('Ticket'))
        .beginGroup()
          .contains('fullnameCanonical', filterCanonical, true)
          .or()
          .contains('fullnameCanonicalReverse', filterCanonical, true)
        .endGroup()
        .findAll()
      ;

I also tried to escape the double quotes the JSON way with backslashes, it does not crash anymore but does not find the matching items which do contain double quotes

Working without realm-query:

items = realmStorageManager.getRealm().objects('Ticket')
        .filtered('fullnameCanonical CONTAINS[c] $0 \
          OR fullnameCanonicalReverse CONTAINS[c] $0', filterCanonical)
      ;

I googled my problem and found someone saying we should always use the $N to pass strings, maybe this is the problem with this lib.

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

No branches or pull requests

1 participant