ar_indexer 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/ar_indexer.gemspec +2 -2
- data/lib/ar_indexer.rb +1 -1
- data/lib/ar_indexer/indexer.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa39816650293a0f047abdb37904896c014c55bd
|
4
|
+
data.tar.gz: ef02ddc7309dff62fe338855594d10974aa1d51d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee6a361b3a92fefcf3a8e633abf534ab97aac4051e0aedd1760bb91ef9ad08cd20e69f9213701abe185b1ce379466d8a756f438a62782912980e38ce4951db74
|
7
|
+
data.tar.gz: 43eff60e824f598b2ce6acbf71a48ba626edc14c35dd6b3aa8e1ddc37024dc112cee5937a64cc4fbcea7b57e78257aba02bb428c7f5efdb1390b0e8dd28b8e35
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
#ARIndexer#
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/ar_indexer.svg)](http://badge.fury.io/rb/ar_indexer)
|
4
|
+
|
3
5
|
ARIndexer provides basic indexing and text search for ActiveRecord models. You choose which fields to index per model, and the index is automatically generated/updated on create/edit.
|
4
6
|
|
5
7
|
##Installation##
|
@@ -77,7 +79,8 @@ You can also pass an options hash to specify what fields should be searched, how
|
|
77
79
|
|
78
80
|
:sort_method => nil,
|
79
81
|
# Allows for a lambda by which to access a sortable value.
|
80
|
-
#
|
82
|
+
# Pass a proc that takes the AR object to access a sortable value
|
83
|
+
# Pass the symbol of the field name you want to access to just pull the field value
|
81
84
|
|
82
85
|
:sort_direction => :desc,
|
83
86
|
# Sort order, default is DESC so that the most relevant results will be returned first
|
data/ar_indexer.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
# Basic Gem Description
|
3
3
|
spec.name = "ar_indexer"
|
4
|
-
spec.version = "0.2.
|
5
|
-
spec.date = "2014-10-
|
4
|
+
spec.version = "0.2.2"
|
5
|
+
spec.date = "2014-10-08"
|
6
6
|
spec.summary = "Allows for reverse indexing selected ActiveRecord models. Handles searching and return of objects"
|
7
7
|
spec.description = spec.summary
|
8
8
|
spec.authors = ["Josh MacLachlan"]
|
data/lib/ar_indexer.rb
CHANGED
data/lib/ar_indexer/indexer.rb
CHANGED
@@ -6,6 +6,8 @@ module ARIndexer
|
|
6
6
|
# Decode HTML entities
|
7
7
|
coder = HTMLEntities.new
|
8
8
|
value = coder.decode(value)
|
9
|
+
# Split words on slashes and dashes
|
10
|
+
value.gsub!(/[\/\-]/, ' ')
|
9
11
|
# Remove most punctuation
|
10
12
|
value.gsub!(/[^a-zA-Z0-9\s]/, '')
|
11
13
|
# Move everything to lower case
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ar_indexer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh MacLachlan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|