Hearch 2018.8.31 → 2018.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/Hearch.rb +10 -2
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 027d6569ecfe8136979a5e251cb8b47613613515
4
- data.tar.gz: f5c63fa7936c14655806a227bac9810f973b5eda
3
+ metadata.gz: 2e2212da238f50326e06fdf482672bfa92d95c8c
4
+ data.tar.gz: 6f5c0611e3b7f89489d87db0cf04f248eaf73db1
5
5
  SHA512:
6
- metadata.gz: 7bccddf365d81d95fb52cef66f2ef98b50a276b1a35dd144423317d64167b441fa72f33611d032f86d982910b8a4ae3752fc74d04bf8d877ad87a73deeb510b1
7
- data.tar.gz: 7faf5c16c64a253c8cb8fb8656fbb56933ede895b5a6f8928109591ee40883f90fa839cc7795ba2ebc1609212ad3f294f961bce3cad82ece552ca5ebe6040045
6
+ metadata.gz: 1a07e886d626e3f820fb5ce55fff67eaee73d985059d7f146cd0828f12ddc9de2ca4cedb42164cc6a7d032001a8a1b064976906ef0094dd5f338427bed299fd0
7
+ data.tar.gz: 68f3fa2cc2a455245d82cee863065c8d8cb0b588032a9be9bff102ba024234aefb38334adaf64c1a162020a148cc1f4ec40187e76f322f3358865fa636f9d90e
@@ -5,6 +5,7 @@ $LOAD_PATH.unshift File.expand_path('../Hearch', __FILE__)
5
5
  # require 'Hearch/HearchIndexEntry_pb'
6
6
  require 'Hearch/HearchIndex_pb'
7
7
  require 'rmmseg'
8
+ require 'set'
8
9
 
9
10
  include RMMSeg
10
11
 
@@ -78,7 +79,6 @@ class Hearch
78
79
 
79
80
  @index.entry.each do |currentEntry| #一个个条目地比较。
80
81
  keywordList.each do |currentKeyword| #一个个关键字地比较。
81
- # puts "Current keyword: ", currentKeyword, ", current entry keyword: ", currentEntry.keyword #Debug.
82
82
  if currentEntry.keyword==currentKeyword #关键字相同。
83
83
  resultList << currentEntry.articleId #将文章编号加入到结果列表中。
84
84
 
@@ -110,7 +110,15 @@ class Hearch
110
110
 
111
111
  @index.entry.each do |currentEntry| #一个个条目地比较。
112
112
  if currentEntry.keyword==currentKeyword #关键字相同。
113
- currentEntry.articleId << articleId #将文章编号加入到文章编号列表中。
113
+ articleIdSet=Set.new #文章编号集合。
114
+
115
+ articleIdSet=currentEntry.articleId.to_set #将文章编号列表转换成文章编号集合。
116
+
117
+ articleIdSet << articleId #加入文章编号。
118
+
119
+ currentEntry.articleId=Google::Protobuf::RepeatedField.new( :int32 , []) #初始化文章编号列表。
120
+
121
+ currentEntry.articleId+=articleIdSet.to_a #重新转换成文章编号列表。
114
122
 
115
123
  existEntry=true #是命中了已有条目。
116
124
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Hearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 2018.8.31
4
+ version: 2018.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hxcan Cai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-31 00:00:00.000000000 Z
11
+ date: 2018-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  version: '0'
96
96
  requirements: []
97
97
  rubyforge_project:
98
- rubygems_version: 2.5.2.3
98
+ rubygems_version: 2.4.5.1
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Hearch ruby.