komainu 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -60,12 +60,12 @@ module Komainu
60
60
  def find_matches text, string
61
61
  text = text.downcase
62
62
  matches = []
63
+ offset = 0
63
64
  string.split(" ").each { |word|
64
65
  word = word.downcase
65
- offset = 0
66
66
  while matched_index = text.index(word, offset)
67
67
  matches << Match.new(matched_index, word)
68
- offset += word.length
68
+ offset = matched_index + 1
69
69
  end
70
70
  }
71
71
  matches
@@ -1,3 +1,3 @@
1
1
  module Komainu
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -52,11 +52,13 @@ module Komainu
52
52
 
53
53
  result = SearchesText.new([item]).search("derp herp")
54
54
 
55
+ result.items.first.matches.size.must_equal 2
56
+
55
57
  result.items.first.matches[0].text.must_equal "derp"
56
58
  result.items.first.matches[0].index.must_equal 0
57
59
 
58
- result.items.first.matches[2].text.must_equal "herp"
59
- result.items.first.matches[2].index.must_equal 5
60
+ result.items.first.matches[1].text.must_equal "herp"
61
+ result.items.first.matches[1].index.must_equal 5
60
62
  end
61
63
  end
62
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: komainu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest
16
- requirement: &70258233968580 !ruby/object:Gem::Requirement
16
+ requirement: &70258054636300 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70258233968580
24
+ version_requirements: *70258054636300
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70258233967340 !ruby/object:Gem::Requirement
27
+ requirement: &70258054634820 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70258233967340
35
+ version_requirements: *70258054634820
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: docu
38
- requirement: &70258233966460 !ruby/object:Gem::Requirement
38
+ requirement: &70258054633900 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70258233966460
46
+ version_requirements: *70258054633900
47
47
  description: Simple text search using a mixture of basic string search and Levenshtein
48
48
  Distance
49
49
  email: