infopark_fiona7 1.2.0.1.4 → 1.2.0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8cba5228a981890aa7cfb8f6c59c2e3fbaff1553
4
- data.tar.gz: 08330c953d938833085ccdbfbbf68f2490b2400a
3
+ metadata.gz: 95e1d0c153cae176d4413ba9de85700117ff2119
4
+ data.tar.gz: 073a4693abd33326b6d2218d7d0f69eb95a6c81a
5
5
  SHA512:
6
- metadata.gz: 2846235f3e810fe9899fc4ed254896c8e5abf2ce9b5d9dcc99a1d5490e6b933230eb1c7e939f5489f28700a96b1bd5ffd25184f100afe1493ee38835b78a5a2f
7
- data.tar.gz: bb5baf49c42113c9379fff3671123b17072ecab572ea9de0020c3b55a3075fd616970436a31dac105cb2363f04cd1507a63859845b532d1617aa55a601b4bf1e
6
+ metadata.gz: e4684651e4eea73bcc38691a9ae8b0441063c190cd71b6a67637c2022eb9b2bcfb14fd306a9dda84f5d1b9dd3141f2f4594a8b373db98354b304780915cf1e8b
7
+ data.tar.gz: 47871bc4bdd0a6ee52369e9b07f83b89af87a0c16a483c63fd0d2ed89a11d56fa0cf8425081a58912800f7814edcfa5813b2e47508f90e3343cc02234b4f66e6
@@ -286,7 +286,7 @@ module Fiona7
286
286
  def use_naive_search_engine?(query)
287
287
  false ||
288
288
  query.empty? ||
289
- query.any? {|q| (q[:field].to_sym == :_path || q[:field].to_sym == :_name)&& (q[:operator].to_sym == :equal || q[:operator].to_sym == :prefix || query.length == 1)} ||
289
+ query.any? {|q| (q[:field].to_sym == :_path || q[:field].to_sym == :_name)&& (query.length == 1)} ||
290
290
  query.any? {|q| q[:field].to_sym == :_parent_path && (q[:operator].to_sym == :equal || query.length == 1)} ||
291
291
  (query.length == 1 && query.first[:field].to_sym == :_modification) ||
292
292
  (query.length == 1 && query.first[:field].to_sym == :_obj_class) ||
@@ -86,13 +86,14 @@ module Fiona7
86
86
  conditions = query.map do |q|
87
87
  field = resolve_field_name(q[:field])
88
88
 
89
- # paths are sadly not in the search index by default.
90
- next if field == :visiblePath
91
-
92
89
  case q[:operator]
93
90
  when :equal
94
91
  if field == :__dummy__
95
92
  '("edited" <#IN> state)'
93
+ elsif field ==:_path
94
+ paths = Array(q[:value])
95
+ ids = Fiona7::WriteObj.where(path: paths).select(:obj_id).limit(1000).map(&:obj_id).map(&:to_s).presence || ["1000"]
96
+ search_in(:objId, ids)
96
97
  else
97
98
  search_in(field, q[:value])
98
99
  end
@@ -113,6 +114,12 @@ module Fiona7
113
114
  values = as_values_array(q[:value])
114
115
  values = values.map {|v| "#{v}*" }
115
116
  full_text_query_string(values)
117
+ elsif field == :_path
118
+ query = []
119
+ paths = Array(q[:value]).map {|p| "#{p}%" }
120
+ paths.each { |_| query << " (path LIKE ?) " }
121
+ ids = Fiona7::WriteObj.where(query.join(' AND '), paths).select(:obj_id).limit(1000).map(&:obj_id).map(&:to_s).presence || ["1000"]
122
+ search_in(:objId, ids)
116
123
  else
117
124
  values = as_values_array(q[:value])
118
125
  values = values.map {|v| "#{v}*" }
@@ -136,7 +143,7 @@ module Fiona7
136
143
 
137
144
  def search_in(field, values)
138
145
  values = [values] unless values.kind_of?(Array)
139
- if [:objClass, :obj_id, :permalink, :lastChanged, :name].include?(field)
146
+ if [:objClass, :objId, :permalink, :lastChanged, :name].include?(field)
140
147
  fields = [field.to_s]
141
148
  else
142
149
  fields = Fiona7::AttributeNamesFromQueries.new(field.to_s, @query).attributes || Fiona7::AttributeNamesFromCms.new(field.to_s).attributes || [field.to_s]
@@ -172,11 +179,15 @@ module Fiona7
172
179
  when :_obj_class
173
180
  :objClass
174
181
  when :_path
175
- :visiblePath
182
+ :_path
176
183
  when :_modification
177
184
  :__dummy__
178
185
  when :id
179
- :obj_id
186
+ :objId
187
+ when :_id
188
+ :objId
189
+ when :obj_id
190
+ :objId
180
191
  when :_permalink
181
192
  :permalink
182
193
  when :_last_changed
@@ -1,3 +1,3 @@
1
1
  module Fiona7
2
- VERSION = "1.2.0.1.4"
2
+ VERSION = "1.2.0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_fiona7
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.1.4
4
+ version: 1.2.0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Przedmojski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-31 00:00:00.000000000 Z
11
+ date: 2017-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails