mongoid_text_search 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,24 +1,22 @@
1
1
  # Overview
2
2
 
3
- This gem is used in addition to Mongoid gem (up to version 2.0.0.beta.20), to provide simple search function.
4
- It takes one or many string fields. Those strings will be cleaned up and transform into array so they can be indexed.
5
- Searching later on will simply partially matches the input keywords with the indexed keywords in the arrays.
3
+ This gem is used in addition to Mongoid gem (up to version 2.0.0.beta.20), to provide simple full text search function. It takes one or many string or array of strings fields. The strings will be cleaned up and transform into array so they can be indexed. Searching later on will simply partially matches the input keywords with the indexed keywords in the arrays.
6
4
 
7
5
  ## Installation
8
6
 
9
- gem "mongoid-simple_search"
7
+ gem "mongoid_text_search"
10
8
 
11
9
  ## Getting Started
12
10
 
13
11
  Add the following into your model.
14
12
 
15
- include Mongoid::SimpleSearch
13
+ include Mongoid::TextSearch
16
14
 
17
- Specify which field(s) to be included as the keywords.
15
+ Specify which field(s) to be included as the keywords. Fields should be string or array of strings.
18
16
 
19
- simple_search_for_fields :title, :description
17
+ text_search_for_fields :title, :description
20
18
 
21
- The above will create three new fields (array type): title_keywords, description_keywords, and keywords.
19
+ The above will create a new field called keywords.
22
20
 
23
21
  ## Available Class Methods
24
22
 
@@ -29,9 +27,4 @@ Convert any string into an array of clean keywords.
29
27
  Search documents with an array of keywords to match.
30
28
  Use the previous method to generate an array of clean keywords from a string.
31
29
 
32
- with_keywords(array)
33
-
34
- There are also dynamic search methods for each field that was passed in simple_search_for_fields method.
35
-
36
- with_title_keywords(array)
37
- with_description_keywords(array)
30
+ with_keywords(array)
@@ -17,11 +17,11 @@ module Mongoid
17
17
  end
18
18
  for keyword in keywords
19
19
  if keyword.is_a?(String)
20
- keyword.downcase!
21
- keyword.strip!
22
- keyword.gsub!(StripPunctuationRegex, PunctuationReplacement)
23
- if keyword.size > 2 && !IgnoredWords.include?(keyword) && !clean_keywords.include?(keyword)
24
- clean_keywords << keyword
20
+ clean_keyword = keyword.downcase
21
+ clean_keyword = clean_keyword.strip
22
+ clean_keyword.gsub!(StripPunctuationRegex, PunctuationReplacement)
23
+ if clean_keyword.size > 2 && !IgnoredWords.include?(clean_keyword) && !clean_keywords.include?(clean_keyword)
24
+ clean_keywords << clean_keyword
25
25
  end
26
26
  end
27
27
  end
@@ -1,5 +1,5 @@
1
1
  module Mongoid
2
2
  module TextSearch
3
- VERSION = "0.1"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,11 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongoid_text_search
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- version: "0.1"
4
+ prerelease:
5
+ version: 0.1.1
9
6
  platform: ruby
10
7
  authors:
11
8
  - Steve Randy Tantra
@@ -13,7 +10,7 @@ autorequire:
13
10
  bindir: bin
14
11
  cert_chain: []
15
12
 
16
- date: 2011-01-31 00:00:00 +07:00
13
+ date: 2011-02-13 00:00:00 +07:00
17
14
  default_executable:
18
15
  dependencies:
19
16
  - !ruby/object:Gem::Dependency
@@ -24,12 +21,6 @@ dependencies:
24
21
  requirements:
25
22
  - - <=
26
23
  - !ruby/object:Gem::Version
27
- segments:
28
- - 2
29
- - 0
30
- - 0
31
- - beta
32
- - 20
33
24
  version: 2.0.0.beta.20
34
25
  type: :runtime
35
26
  version_requirements: *id001
@@ -67,21 +58,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
58
  requirements:
68
59
  - - ">="
69
60
  - !ruby/object:Gem::Version
70
- segments:
71
- - 0
72
61
  version: "0"
73
62
  required_rubygems_version: !ruby/object:Gem::Requirement
74
63
  none: false
75
64
  requirements:
76
65
  - - ">="
77
66
  - !ruby/object:Gem::Version
78
- segments:
79
- - 0
80
67
  version: "0"
81
68
  requirements: []
82
69
 
83
70
  rubyforge_project: mongoid_text_search
84
- rubygems_version: 1.3.7
71
+ rubygems_version: 1.5.0
85
72
  signing_key:
86
73
  specification_version: 3
87
74
  summary: Simple full text search for Mongoid.