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

Search include all values in list #24

Open
okkez opened this issue May 15, 2017 · 2 comments
Open

Search include all values in list #24

okkez opened this issue May 15, 2017 · 2 comments

Comments

@okkez
Copy link
Member

okkez commented May 15, 2017

Currently,

Facility.select.output_columns(["name"].filter("levels == 'A' && levels == 'B' && levels == 'C'")

I want to write same query like following:

Facility.select.output_columns(["name"]).filter.in_values(:levels, include_all: true, %w(A B C))
# or
Facility.select.output_columns(["name"]).filter.include_all_values(:levels, %w(A B C))

How about this?

@kou
Copy link
Member

kou commented May 16, 2017

Extending in_values isn't good idea. in_values is the same semantics as IN in SQL.
We should not add AND mode to in_values.

The following will return what you want:

Facility.select.filter("query(%{match_columns}, %{query})", match_columns: "levels", query: "A B C")

It's a good idea that we provide the following API for this use case:

select.filter.query([:levels], "A B C")

NOTE: It seems that using == for vector is unexpected. @ is a suitable operator for "whether the specified element is included in the vector" query.

@okkez
Copy link
Member Author

okkez commented May 19, 2017

select.filter.query([:levels], "A B C")

is LGTM.

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

2 participants