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

How To: execute complex searches #224

Open
MR4online opened this issue Jan 11, 2024 · 4 comments
Open

How To: execute complex searches #224

MR4online opened this issue Jan 11, 2024 · 4 comments

Comments

@MR4online
Copy link

MR4online commented Jan 11, 2024

Hi there,

is there a way to execute some more complex search queries?

Examples:

  1. FIND album WHERE year = 1990 OR year IS NULL (or undefined)
    [EDIT: this will not work at all (redis search limitation)]

  2. FIND album WHERE (year = 1990 OR year = 2000) AND foo = "bar

  3. FIND album WHERE year = 1990 OR (year = 2000 AND foo = "bar)

In the given examples I don't see if this is possible, or I'm not sure how RedisOM handles multiple AND & OR associations.
Or is there at least a way to print the generated search-query?

[EDIT: one can log the search query:

const search = albumRepository.search().where('year').eq(1984);
console.log(search.query);
await search.return.all();

]

Thank you!

@SylvainAssemat
Copy link

SylvainAssemat commented Mar 23, 2024

Hi

Maybe could you look at the "filter" method using Predicate in EntityStream ?
With this you could chain AND / OR condition in order to get what you expect.

@JohnLopen
Copy link

Hi

Maybe could you look at the "filter" method using Predicate in EntityStream ? With this you could chain AND / OR condition in order to get what you expect.

Hi, I'm applying your suggestion to my solution, but I'm curious how long can the chain go? Because when I try chaining more than 10 search terms it failed

@SylvainAssemat
Copy link

I have already use more than 10 chain without any problem (multiple OR for geoqueries tiles)

Can you post a snippet maybe ?

@JohnLopen
Copy link

I have already use more than 10 chain without any problem (multiple OR for geoqueries tiles)

Can you post a snippet maybe ?

Thank you for your quick response. I have posted an issue here, and detailed everything, will this help?

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

3 participants