dxtitle_search 0.3.2 → 0.3.3
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/lib/dxtitle_search.rb +27 -24
- data.tar.gz.sig +0 -0
- metadata +2 -2
- 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: fb844f529ab06c2cc4e084e3f5af0f41ab4425d6dc7b9194b210963f5e37da39
|
4
|
+
data.tar.gz: 80a837d7414e45ce4dee39e2a4025ad8419b090d3ae3f057c4236d4d6961a0b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6482d7adffc9dc3ba09925d770ef6ad6aacc0ba771b2e703540d4ef7d34b009b49b60318e8450d617d64ed865bc55d70c8b4b447bb06a2f0c3be86f6fe1cc327
|
7
|
+
data.tar.gz: fd11a8b0080b6f48790d5524c14144bdb578761b6e47c6a346c9cb7d736998f5f7b862bac28d91e37bf94abce5b429ed61e28a681e6061683da97cddb8b51a8c
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/dxtitle_search.rb
CHANGED
@@ -6,6 +6,7 @@ require 'indexer101'
|
|
6
6
|
|
7
7
|
|
8
8
|
class DxTitleSearch
|
9
|
+
using ColouredText
|
9
10
|
|
10
11
|
def initialize(obj=nil, sources: nil, level: 1, debug: false)
|
11
12
|
|
@@ -14,24 +15,26 @@ class DxTitleSearch
|
|
14
15
|
@level = level
|
15
16
|
|
16
17
|
s = if sources then
|
17
|
-
|
18
|
-
|
18
|
+
|
19
|
+
puts "found sources".info if @debug
|
20
|
+
dx = Dynarex.new(sources)
|
21
|
+
|
19
22
|
puts 'before scan_dxindex' if @debug
|
20
23
|
a = dx.all.map(&:uri)
|
21
24
|
puts 'a: ' + a.inspect if @debug
|
22
25
|
@indexer.scan_dxindex a, level: level
|
23
|
-
|
24
|
-
elsif obj and (obj.is_a?(DxLite) or obj.is_a?(Dynarex)) or obj.lines.length < 2
|
26
|
+
|
27
|
+
elsif obj and (obj.is_a?(DxLite) or obj.is_a?(Dynarex)) or obj.lines.length < 2
|
25
28
|
|
26
29
|
@indexer.scan_dxindex obj, level: level
|
27
|
-
|
30
|
+
|
28
31
|
end
|
29
|
-
|
32
|
+
|
30
33
|
#jr230620 @indexer.build
|
31
34
|
|
32
35
|
end
|
33
36
|
|
34
|
-
def search(keywords, minchars: 3)
|
37
|
+
def search(keywords, minchars: 3)
|
35
38
|
|
36
39
|
a2 = @indexer.search keywords.split(/[\s:"!\?\(\)£]+(?=[\w#_'-]+)/), \
|
37
40
|
minchars: minchars
|
@@ -43,55 +46,55 @@ class DxTitleSearch
|
|
43
46
|
end
|
44
47
|
|
45
48
|
puts 'a3: ' + a3.inspect if @debug
|
46
|
-
|
49
|
+
|
47
50
|
@dx = Dynarex.new('results/result(title, url, date)').import(a3)
|
48
|
-
|
51
|
+
|
49
52
|
def a3.to_dx()
|
50
53
|
Dynarex.new('results/result(title, url, date)').import(self)
|
51
54
|
end
|
52
|
-
|
55
|
+
|
53
56
|
def a3.to_tags()
|
54
57
|
a = self.map {|x| x[:title].scan(/(?<=#)(\w+)/)}.flatten
|
55
58
|
a.uniq.sort.map {|x| [x, a.count(x)]}
|
56
|
-
end
|
57
|
-
|
59
|
+
end
|
60
|
+
|
58
61
|
def a3.search(keywords)
|
59
|
-
|
62
|
+
|
60
63
|
dx = Dynarex.new('results/result(title, url, date)').import(self)
|
61
64
|
|
62
65
|
level = keywords[0] == '#' ? 0 : 1
|
63
66
|
dts = DxTitleSearch.new dx, level: level
|
64
67
|
dts.search keywords
|
65
|
-
|
68
|
+
|
66
69
|
end
|
67
|
-
|
70
|
+
|
68
71
|
def a3.tag_search(keywords)
|
69
|
-
|
72
|
+
|
70
73
|
dx = Dynarex.new('results/result(title, url, date)').import(self)
|
71
74
|
|
72
75
|
level = keywords[0] == '#' ? 0 : 1
|
73
76
|
dts = DxTitleSearch.new dx, level: level
|
74
77
|
dts.tag_search keywords
|
75
|
-
|
76
|
-
end
|
77
78
|
|
78
|
-
|
79
|
+
end
|
80
|
+
|
81
|
+
return Array.new(a3)
|
79
82
|
|
80
83
|
end
|
81
|
-
|
82
|
-
def tag_search(keywords)
|
84
|
+
|
85
|
+
def tag_search(keywords)
|
83
86
|
r = @indexer.lookup *keywords.split(/[\W]+(?=[\w]+)/).map {|x| "#" + x}
|
84
87
|
r.map {|x| x.to_s[1..-1]}
|
85
88
|
end
|
86
89
|
|
87
90
|
def to_tags()
|
88
|
-
|
91
|
+
|
89
92
|
a = @indexer.index.map do |key, value|
|
90
93
|
[key.to_s[1..-1], value.length]
|
91
94
|
end
|
92
|
-
|
95
|
+
|
93
96
|
a.sort_by(&:first)
|
94
|
-
|
97
|
+
|
95
98
|
end
|
96
99
|
|
97
100
|
end
|
data.tar.gz.sig
CHANGED
Binary file
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
g10O6gIBUztpsNHwbBTi9fHgtis4E5dAPAo4uzo4MCKVwi72iZQ3E92ACYb9zlxA
|
36
36
|
g6CsTY0vUjhgfh9taSRj3qxd
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2022-01-25 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: indexer101
|
metadata.gz.sig
CHANGED
Binary file
|