Skip to content

Commit

Permalink
Correctly matched post_title and post_content.
Browse files Browse the repository at this point in the history
  • Loading branch information
robwilliams committed May 21, 2012
1 parent 009c34e commit 1fd81e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions lib/active_press/models/post.rb
Expand Up @@ -19,15 +19,9 @@ class ActivePress::Post < ActivePress::Base

# Basic post search.
# Requires FULLTEXT indexes on post_name and post_content
# ALTER TABLE wp_posts ADD FULLTEXT(post_name);
# ALTER TABLE wp_posts ADD FULLTEXT(post_content);
# alter table wp_posts add fulltext(post_title, post_content);
def self.search(query)
where(
['(MATCH(post_name) against ?) OR (MATCH(post_content) against ?)',
query,
query
]
)
where(['MATCH (post_title, post_content) AGAINST (?) > 0', query])
end

def self.by_year(d)
Expand Down
2 changes: 1 addition & 1 deletion lib/active_press/version.rb
@@ -1,3 +1,3 @@
module ActivePress
VERSION = "0.0.9"
VERSION = "0.1.0"
end

0 comments on commit 1fd81e9

Please sign in to comment.