active_press 0.0.9 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/active_press/models/post.rb +2 -8
- data/lib/active_press/version.rb +1 -1
- metadata +1 -1
@@ -19,15 +19,9 @@ class ActivePress::Post < ActivePress::Base
|
|
19
19
|
|
20
20
|
# Basic post search.
|
21
21
|
# Requires FULLTEXT indexes on post_name and post_content
|
22
|
-
#
|
23
|
-
# ALTER TABLE wp_posts ADD FULLTEXT(post_content);
|
22
|
+
# alter table wp_posts add fulltext(post_title, post_content);
|
24
23
|
def self.search(query)
|
25
|
-
where(
|
26
|
-
['(MATCH(post_name) against ?) OR (MATCH(post_content) against ?)',
|
27
|
-
query,
|
28
|
-
query
|
29
|
-
]
|
30
|
-
)
|
24
|
+
where(['MATCH (post_title, post_content) AGAINST (?) > 0', query])
|
31
25
|
end
|
32
26
|
|
33
27
|
def self.by_year(d)
|
data/lib/active_press/version.rb
CHANGED