name_search 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc
CHANGED
@@ -1,3 +1,31 @@
|
|
1
1
|
= Name Search
|
2
2
|
|
3
|
-
|
3
|
+
Perform natural searches on people's names
|
4
|
+
|
5
|
+
For example, a search for 'Andrew Smith' will return matches on 'Andy Smith' and 'Smith, Andrew'
|
6
|
+
|
7
|
+
== Installation
|
8
|
+
|
9
|
+
Add the gem to the gemfile
|
10
|
+
|
11
|
+
gem 'name_search'
|
12
|
+
|
13
|
+
Generate the migration file
|
14
|
+
|
15
|
+
rails generate name_search:migration
|
16
|
+
|
17
|
+
Run the migration
|
18
|
+
|
19
|
+
rake db:migrate
|
20
|
+
|
21
|
+
=== Populating Nick Names
|
22
|
+
|
23
|
+
A couple of rake tasks are included to pre-populate the database with common nick names.
|
24
|
+
|
25
|
+
Nick names from the 1990 census
|
26
|
+
|
27
|
+
rake name_search:add_census_nick_names
|
28
|
+
|
29
|
+
Other common nick names that are not part of the 1990 census
|
30
|
+
|
31
|
+
rake name_search:add_contributed_nick_names
|
@@ -0,0 +1 @@
|
|
1
|
+
jennifer jennie jen jenny
|
@@ -1,15 +1,14 @@
|
|
1
1
|
module NameSearch
|
2
2
|
module NameSearchOn
|
3
3
|
def name_search_on(*attributes)
|
4
|
-
write_inheritable_attribute(:name_search_attributes, attributes)
|
5
|
-
class_inheritable_reader(:name_search_attributes)
|
6
|
-
|
7
4
|
def name_search(name, options = {})
|
8
5
|
NameSearch::Search.new(self, name, options)
|
9
6
|
end
|
10
7
|
|
11
8
|
class_eval do
|
12
9
|
include NameSearchablesConcerns
|
10
|
+
class_attribute :name_search_attributes
|
11
|
+
self.name_search_attributes = attributes
|
13
12
|
|
14
13
|
after_save :sync_name_searchables
|
15
14
|
has_many :name_searchables, :as => :searchable, :dependent => :destroy,
|
@@ -21,4 +21,10 @@ namespace :name_search do
|
|
21
21
|
census_file = File.expand_path('../../../assets/census_nick_names.txt', __FILE__)
|
22
22
|
NameSearch::NickNameFamily.update_families_from_file(census_file)
|
23
23
|
end
|
24
|
+
|
25
|
+
desc 'adds the contributed nick names to the database'
|
26
|
+
task :add_contributed_nick_names => :environment do
|
27
|
+
nick_name_file = File.expand_path('../../../assets/contributed_nick_names.txt', __FILE__)
|
28
|
+
NameSearch::NickNameFamily.update_families_from_file(nick_name_file)
|
29
|
+
end
|
24
30
|
end
|
data/lib/name_search/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: name_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-05-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,9 +21,15 @@ dependencies:
|
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
|
26
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.0.0
|
30
|
+
description: A natural search for a person by name will not only take into consideration
|
31
|
+
word ordering ('Andrew Smith' == 'Smith, Andrew') but it will also look for nick
|
32
|
+
names ('Andy' == 'Andrew')
|
27
33
|
email:
|
28
34
|
- paulyoder@gmail.com
|
29
35
|
executables: []
|
@@ -31,6 +37,7 @@ extensions: []
|
|
31
37
|
extra_rdoc_files: []
|
32
38
|
files:
|
33
39
|
- lib/assets/census_nick_names.txt
|
40
|
+
- lib/assets/contributed_nick_names.txt
|
34
41
|
- lib/generators/name_search/migration/migration_generator.rb
|
35
42
|
- lib/generators/name_search/migration/templates/migration.rb
|
36
43
|
- lib/name_search/active_relation_search.rb
|
@@ -70,9 +77,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
77
|
version: '0'
|
71
78
|
requirements: []
|
72
79
|
rubyforge_project:
|
73
|
-
rubygems_version: 1.8.
|
80
|
+
rubygems_version: 1.8.24
|
74
81
|
signing_key:
|
75
82
|
specification_version: 3
|
76
|
-
summary:
|
77
|
-
word ordering.
|
83
|
+
summary: Perform natural searches on people’s names.
|
78
84
|
test_files: []
|