Hearch 2018.8.31 → 2018.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/Hearch.rb +10 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e2212da238f50326e06fdf482672bfa92d95c8c
|
4
|
+
data.tar.gz: 6f5c0611e3b7f89489d87db0cf04f248eaf73db1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a07e886d626e3f820fb5ce55fff67eaee73d985059d7f146cd0828f12ddc9de2ca4cedb42164cc6a7d032001a8a1b064976906ef0094dd5f338427bed299fd0
|
7
|
+
data.tar.gz: 68f3fa2cc2a455245d82cee863065c8d8cb0b588032a9be9bff102ba024234aefb38334adaf64c1a162020a148cc1f4ec40187e76f322f3358865fa636f9d90e
|
data/lib/Hearch.rb
CHANGED
@@ -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
|
-
|
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.
|
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-
|
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.
|
98
|
+
rubygems_version: 2.4.5.1
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Hearch ruby.
|