-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add sql based filters #6
Conversation
@@ -0,0 +1,45 @@ | |||
module FortyFacets | |||
class ScopeFacetFilterDefinition < FilterDefinition | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at class body beginning.
6cd6243
to
6d290a4
Compare
assert_equal 6, search.result.size | ||
search = MovieSearch.new("search" => { "classics" => "non_classics" }) | ||
assert_equal 34, search.result.size | ||
search = MovieSearch.new("search" => { "classics" => ["non_classics", "classics"] }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [88/80]
6d290a4
to
518c57a
Compare
end | ||
|
||
def facet | ||
query = definition.queries.map { |key, query| "(#{query}) as #{key}" }.join(', ') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shadowing outer local variable - query
.
Line is too long. [89/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
counts.map do |count| | ||
definition.queries.each do |key, _| | ||
result[key] ||= 0 | ||
result[key] += count.occurrences if [1, '1', true].include?(count[key]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [83/80]
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
518c57a
to
4cdd532
Compare
|
||
counts = without.result.reorder("") | ||
.select(query) | ||
.group(definition.queries.keys) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place the . on the previous line, together with the method call receiver.
Align the operands of an expression in an assignment spanning multiple lines.
No description provided.