Skip to content

Commit

Permalink
Hacking travis
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefanni committed Aug 11, 2018
1 parent a2ac3ca commit 42c5e32
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class User < ActiveRecord::Base
before_save :set_token
after_destroy :destroy_drupal_user

def self.search_by_username(query)
User.where('MATCH(username) AGAINST((?) IN BOOLEAN MODE)', query + '*')
def self.search(query)
User.where('MATCH(bio, username) AGAINST(? IN BOOLEAN MODE)', query + '*')
end

def new_contributor
Expand Down
2 changes: 1 addition & 1 deletion app/services/srch_scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class SrchScope
def self.find_users(query, limit)
if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
User.search_by_username(query)
User.search(query)
.where('rusers.status = ?', 1)
.limit(limit)
else
Expand Down
3 changes: 2 additions & 1 deletion db/schema.rb.example
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ ActiveRecord::Schema.define(version: 2018_08_04_215454) do
t.string "token"
t.integer "status", default: 0
t.integer "password_checker", default: 0
t.index ["username"], name: "rusers_username_fulltext_idx", type: :fulltext
t.index ["username", "bio"], name: "index_rusers_on_username_and_bio", type: :fulltext if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
t.index ["username"], name: "rusers_username_fulltext_idx", type: :fulltext if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
end

create_table "tag_selections", id: false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t|
Expand Down
2 changes: 1 addition & 1 deletion test/unit/user_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class UserTest < ActiveSupport::TestCase
test 'user mysql native fulltext search' do
assert User.count > 0
if ActiveRecord::Base.connection.adapter_name == 'Mysql2'
users = User.search_by_username('jeff')
users = User.search('jeff')
assert_not_nil users
assert users.length > 0
end
Expand Down

0 comments on commit 42c5e32

Please sign in to comment.