-
Notifications
You must be signed in to change notification settings - Fork 1
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
Develop #7
base: master
Are you sure you want to change the base?
Develop #7
Changes from 4 commits
4b2ed7c
cfd68e7
4d4db4c
e415413
789c93b
18b0f2d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
web: bundle exec rackup config.ru -p $PORT |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,33 @@ class Event | |
# Location | ||
property :location, String | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra blank line detected. |
||
def self.ft_search(query_string, model_attributes) | ||
# A crude, full text-ish search for events. | ||
# Parameters: | ||
# query_string = basic string, no operators are supported at this time. | ||
# model_attributes = array of model attributes as symbols. | ||
|
||
# split up search term into tokens | ||
search_terms = query_string.split(' ').map{ |q| "%#{q}%" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space missing to the left of {. |
||
# using ILIKE for better querying. | ||
operator = "ILIKE" | ||
|
||
num_attr = model_attributes.count | ||
|
||
# build out individual queries "<attribute> <operator> ? " | ||
# so we can compose a larger query of something like: | ||
# title ILIKE ? OR title ILIKE ? | ||
query_chunks = model_attributes.map{|attr| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid using {...} for multi-line blocks. |
||
Array.new(search_terms.count){ "#{attr.to_s} #{operator} ?" }.join(' OR ') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Redundant use of |
||
} | ||
query = [query_chunks.flatten.join(' OR ')].concat( search_terms*num_attr) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Surrounding space missing for operator '*'. |
||
|
||
# execute query on events | ||
Event.all( conditions: query ) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space inside parentheses detected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Space inside parentheses detected. |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra empty line detected at body end. |
||
end | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra empty line detected at body end. |
||
end | ||
|
||
class Source | ||
|
Large diffs are not rendered by default.
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.