rifle 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/rifle.rb +7 -7
  2. data/lib/rifle/version.rb +1 -1
  3. metadata +2 -2
@@ -16,8 +16,8 @@ module Rifle
16
16
  p "Flushing all Rifle indices complete"
17
17
  end
18
18
 
19
- def self.store(urn, hash)
20
- Processor.new.index_resource(urn, hash)
19
+ def self.store(urn, hash, additional_search_terms = [])
20
+ Processor.new.index_resource(urn, hash, additional_search_terms)
21
21
  end
22
22
 
23
23
  def self.search(words, options = {})
@@ -27,8 +27,8 @@ module Rifle
27
27
 
28
28
  class Processor
29
29
 
30
- def index_resource(urn, hash)
31
- ::Rails.logger.info "Rifle indexing object with urn #{urn}"
30
+ def index_resource(urn, hash, additional_search_terms = [])
31
+ p "Rifle indexing object with urn #{urn}"
32
32
  # First get the old values
33
33
  old_payload = get_payload_for_urn(urn)
34
34
  if old_payload
@@ -40,7 +40,8 @@ module Rifle
40
40
 
41
41
  # Now get the new ones
42
42
  words = traverse_object_for_word_set(hash)
43
- metaphones = get_metaphones_from_word_set(words)
43
+ words_and_search_terms = words + Array(additional_search_terms)
44
+ metaphones = get_metaphones_from_word_set(words_and_search_terms)
44
45
 
45
46
  # Clear out words that have been removed (but leave ones that are still present in the new version)
46
47
  (old_metaphones - metaphones).each do |metaphone|
@@ -58,7 +59,6 @@ module Rifle
58
59
  end
59
60
 
60
61
  def search_for(sentence, options)
61
- ::Rails.logger.info "Rifle searching for #{sentence}, options #{options}"
62
62
  words = get_words_array_from_text(sentence)
63
63
  metaphones = get_metaphones_from_word_set(Set.new(words))
64
64
 
@@ -69,7 +69,7 @@ module Rifle
69
69
  end
70
70
  urns ||= Set.new
71
71
 
72
- ::Rails.logger.info "Rifle found #{urns.size} urns"
72
+ p "Rifle searching for #{sentence}, options #{options}, found #{urns.size} urns"
73
73
  if options[:urns_only]
74
74
  urns
75
75
  else
@@ -1,3 +1,3 @@
1
1
  module Rifle
2
- VERSION = '0.1.9'
2
+ VERSION = '0.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rifle
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-07 00:00:00.000000000 Z
12
+ date: 2013-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  type: :runtime