solr-ruby 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,11 +46,11 @@ class Solr::Request::Standard < Solr::Request::Select
46
46
  hash = {}
47
47
 
48
48
  # standard request param processing
49
- sort = @params[:sort].collect do |sort|
49
+ hash[:sort] = @params[:sort].collect do |sort|
50
50
  key = sort.keys[0]
51
51
  "#{key.to_s} #{sort[key] == :descending ? 'desc' : 'asc'}"
52
52
  end.join(',') if @params[:sort]
53
- hash[:q] = sort ? "#{@params[:query]};#{sort}" : @params[:query]
53
+ hash[:q] = @params[:query]
54
54
  hash["q.op"] = @params[:operator]
55
55
  hash[:df] = @params[:default_field]
56
56
 
@@ -1,3 +1,15 @@
1
+ # The ASF licenses this file to You under the Apache License, Version 2.0
2
+ # (the "License"); you may not use this file except in compliance with
3
+ # the License. You may obtain a copy of the License at
4
+ #
5
+ # http://www.apache.org/licenses/LICENSE-2.0
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
1
13
  class Solr::Response::Dismax < Solr::Response::Standard
2
14
  # no need for special processing
3
15
 
@@ -1,3 +1,22 @@
1
+ <!--
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ -->
1
20
  <root>
2
21
  <parent>
3
22
  <child attribute="attribute1">text1</child>
@@ -95,8 +95,9 @@ class StandardRequestTest < Test::Unit::TestCase
95
95
  end
96
96
 
97
97
  def test_basic_sort
98
- request = Solr::Request::Standard.new(:query => 'query', :sort => [{:title => :descending}])
99
- assert_equal 'query;title desc', request.to_hash[:q]
98
+ request = Solr::Request::Standard.new(:query => 'query', :sort => [{:title => :descending}, {:date => :ascending}])
99
+ assert_equal 'query', request.to_hash[:q]
100
+ assert_equal 'title desc,date asc', request.to_hash[:sort]
100
101
  end
101
102
 
102
103
  def test_highlighting
@@ -1,3 +1,22 @@
1
+ <!--
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ -->
1
20
  <root>
2
21
  <parent>
3
22
  <child attribute="attribute1">text1</child>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solr-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Apache Solr
@@ -9,7 +9,7 @@ autorequire: solr
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-05 00:00:00 -05:00
12
+ date: 2009-10-12 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -40,7 +40,6 @@ files:
40
40
  - lib/solr/request/add_document.rb
41
41
  - lib/solr/request/base.rb
42
42
  - lib/solr/request/commit.rb
43
- - lib/solr/request/custom.rb
44
43
  - lib/solr/request/delete.rb
45
44
  - lib/solr/request/dismax.rb
46
45
  - lib/solr/request/index_info.rb
@@ -1,50 +0,0 @@
1
- # The ASF licenses this file to You under the Apache License, Version 2.0
2
- # (the "License"); you may not use this file except in compliance with
3
- # the License. You may obtain a copy of the License at
4
- #
5
- # http://www.apache.org/licenses/LICENSE-2.0
6
- #
7
- # Unless required by applicable law or agreed to in writing, software
8
- # distributed under the License is distributed on an "AS IS" BASIS,
9
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- # See the License for the specific language governing permissions and
11
- # limitations under the License.
12
-
13
- require 'erb'
14
-
15
- # "Abstract" base class, only useful with subclasses that add parameters
16
- class Solr::Request::Custom < Solr::Request::Select
17
-
18
- def initialize(qt=nil, params={}, content_type='application/x-www-form-urlencoded; charset=utf-8')
19
- super(qt,params)
20
- @content_type = content_type
21
- end
22
-
23
- def handler
24
- @query_type.starts_with('/') ? qt.remove_first('/') : 'select'
25
- end
26
-
27
- def content_type
28
- @content_type
29
- end
30
-
31
- def to_hash
32
- return {:qt => query_type, :wt => 'ruby'}.merge(@select_params)
33
- end
34
-
35
- def to_s
36
- raw_params = self.to_hash
37
-
38
- http_params = []
39
- raw_params.each do |key,value|
40
- if value.respond_to? :each
41
- value.each { |v| http_params << "#{key}=#{ERB::Util::url_encode(v)}" unless v.nil?}
42
- else
43
- http_params << "#{key}=#{ERB::Util::url_encode(value)}" unless value.nil?
44
- end
45
- end
46
-
47
- http_params.join("&")
48
- end
49
-
50
- end