dxtitle_search 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/dxtitle_search.rb +40 -2
- metadata +3 -3
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e227dc645595c967bf03dd213ea6846c7c9c438a26ee7db3fd059f464493f370
|
4
|
+
data.tar.gz: eccff27f864a56f00f0952d8ddd47a70eaeb2fca6eca24d961cf4c91d54f7387
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db771d09b581573be92de6c65b79c3f635dbcb6187e0bc1d6a00c5d4042a3f13f4838696588d65cc9856be56ed5666047221204e5910fbe38e8aec42f075ee70
|
7
|
+
data.tar.gz: f39cbbb2ca067cfb4c307787b94dab70c7c0d34255037e24e9228b32f284ebbe6361523456d078659aa11e5e3e694ef6dfae3890b18b87ce90d2a707d618a14d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/dxtitle_search.rb
CHANGED
@@ -11,6 +11,7 @@ class DxTitleSearch
|
|
11
11
|
|
12
12
|
@debug = debug
|
13
13
|
@indexer = Indexer101.new debug: debug
|
14
|
+
@level = level
|
14
15
|
|
15
16
|
s = if sources then
|
16
17
|
|
@@ -20,7 +21,7 @@ class DxTitleSearch
|
|
20
21
|
puts 'a: ' + a.inspect if @debug
|
21
22
|
@indexer.scan_dxindex a, level: level
|
22
23
|
|
23
|
-
elsif obj and obj.lines.length < 2
|
24
|
+
elsif obj and (obj.is_a?(DxLite) or obj.is_a?(Dynarex)) or obj.lines.length < 2
|
24
25
|
|
25
26
|
@indexer.scan_dxindex obj, level: level
|
26
27
|
|
@@ -43,9 +44,36 @@ class DxTitleSearch
|
|
43
44
|
|
44
45
|
puts 'a3: ' + a3.inspect if @debug
|
45
46
|
|
47
|
+
@dx = Dynarex.new('results/result(title, url, date)').import(a3)
|
48
|
+
|
46
49
|
def a3.to_dx()
|
47
50
|
Dynarex.new('results/result(title, url, date)').import(self)
|
48
51
|
end
|
52
|
+
|
53
|
+
def a3.to_tags()
|
54
|
+
a = self.map {|x| x[:title].scan(/(?<=#)(\w+)/)}.flatten
|
55
|
+
a.uniq.sort.map {|x| [x, a.count(x)]}
|
56
|
+
end
|
57
|
+
|
58
|
+
def a3.search(keywords)
|
59
|
+
|
60
|
+
dx = Dynarex.new('results/result(title, url, date)').import(self)
|
61
|
+
|
62
|
+
level = keywords[0] == '#' ? 0 : 1
|
63
|
+
dts = DxTitleSearch.new dx, level: level
|
64
|
+
dts.search keywords
|
65
|
+
|
66
|
+
end
|
67
|
+
|
68
|
+
def a3.tag_search(keywords)
|
69
|
+
|
70
|
+
dx = Dynarex.new('results/result(title, url, date)').import(self)
|
71
|
+
|
72
|
+
level = keywords[0] == '#' ? 0 : 1
|
73
|
+
dts = DxTitleSearch.new dx, level: level
|
74
|
+
dts.tag_search keywords
|
75
|
+
|
76
|
+
end
|
49
77
|
|
50
78
|
return a3
|
51
79
|
|
@@ -54,6 +82,16 @@ class DxTitleSearch
|
|
54
82
|
def tag_search(keywords)
|
55
83
|
r = @indexer.lookup *keywords.split(/[\W]+(?=[\w]+)/).map {|x| "#" + x}
|
56
84
|
r.map {|x| x.to_s[1..-1]}
|
57
|
-
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def to_tags()
|
88
|
+
|
89
|
+
a = @indexer.index.map do |key, value|
|
90
|
+
[key.to_s[1..-1], value.length]
|
91
|
+
end
|
92
|
+
|
93
|
+
a.sort_by(&:first)
|
94
|
+
|
95
|
+
end
|
58
96
|
|
59
97
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dxtitle_search
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
version: '0.2'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 0.2.
|
49
|
+
version: 0.2.5
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -56,7 +56,7 @@ dependencies:
|
|
56
56
|
version: '0.2'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 0.2.
|
59
|
+
version: 0.2.5
|
60
60
|
description:
|
61
61
|
email: digital.robertson@gmail.com
|
62
62
|
executables: []
|
metadata.gz.sig
CHANGED
Binary file
|