solr_wrapper 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/Gemfile +6 -0
- data/LICENSE +22 -0
- data/README.md +1 -0
- data/Rakefile +2 -0
- data/lib/solr_wrapper.rb +16 -0
- data/lib/solr_wrapper/instance.rb +214 -0
- data/lib/solr_wrapper/version.rb +3 -0
- data/solr_wrapper.gemspec +28 -0
- data/spec/fixtures/basic_configs/_rest_managed.json +1 -0
- data/spec/fixtures/basic_configs/currency.xml +67 -0
- data/spec/fixtures/basic_configs/lang/stopwords_en.txt +54 -0
- data/spec/fixtures/basic_configs/protwords.txt +21 -0
- data/spec/fixtures/basic_configs/schema.xml +529 -0
- data/spec/fixtures/basic_configs/solrconfig.xml +572 -0
- data/spec/fixtures/basic_configs/stopwords.txt +14 -0
- data/spec/fixtures/basic_configs/synonyms.txt +29 -0
- data/spec/lib/solr_wrapper/instance_spec.rb +17 -0
- data/spec/lib/solr_wrapper_spec.rb +19 -0
- data/spec/spec_helper.rb +9 -0
- metadata +159 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
# contributor license agreements. See the NOTICE file distributed with
|
3
|
+
# this work for additional information regarding copyright ownership.
|
4
|
+
# The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
# (the "License"); you may not use this file except in compliance with
|
6
|
+
# the License. You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
@@ -0,0 +1,29 @@
|
|
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
|
+
#-----------------------------------------------------------------------
|
14
|
+
#some test synonym mappings unlikely to appear in real input text
|
15
|
+
aaafoo => aaabar
|
16
|
+
bbbfoo => bbbfoo bbbbar
|
17
|
+
cccfoo => cccbar cccbaz
|
18
|
+
fooaaa,baraaa,bazaaa
|
19
|
+
|
20
|
+
# Some synonym groups specific to this example
|
21
|
+
GB,gib,gigabyte,gigabytes
|
22
|
+
MB,mib,megabyte,megabytes
|
23
|
+
Television, Televisions, TV, TVs
|
24
|
+
#notice we use "gib" instead of "GiB" so any WordDelimiterFilter coming
|
25
|
+
#after us won't split it into two words.
|
26
|
+
|
27
|
+
# Synonym mappings can be used for spelling correction too
|
28
|
+
pixima => pixma
|
29
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SolrWrapper::Instance do
|
4
|
+
subject { SolrWrapper::Instance.new verbose: true}
|
5
|
+
let(:client) { SimpleSolrClient::Client.new("http://localhost:#{subject.port}/solr/") }
|
6
|
+
describe "#with_collection" do
|
7
|
+
it "should create a new anonymous collection" do
|
8
|
+
subject.wrap do |solr|
|
9
|
+
solr.with_collection(dir: File.join(FIXTURES_DIR, "basic_configs")) do |collection_name|
|
10
|
+
core = client.core(collection_name)
|
11
|
+
expect(core.schema.field('id').name).to eq 'id'
|
12
|
+
expect(core.schema.field('id').stored).to eq true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe SolrWrapper do
|
4
|
+
describe ".wrap" do
|
5
|
+
it "should launch solr" do
|
6
|
+
SolrWrapper.wrap do |solr|
|
7
|
+
expect(Timeout::timeout(1) do
|
8
|
+
begin
|
9
|
+
s = TCPSocket.new('127.0.0.1', solr.port)
|
10
|
+
s.close
|
11
|
+
true
|
12
|
+
rescue
|
13
|
+
false
|
14
|
+
end
|
15
|
+
end).to eq true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: solr_wrapper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Beer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubyzip
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: progressbar
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simple_solr_client
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description:
|
98
|
+
email:
|
99
|
+
- chris@cbeer.info
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- Gemfile
|
106
|
+
- LICENSE
|
107
|
+
- README.md
|
108
|
+
- Rakefile
|
109
|
+
- lib/solr_wrapper.rb
|
110
|
+
- lib/solr_wrapper/instance.rb
|
111
|
+
- lib/solr_wrapper/version.rb
|
112
|
+
- solr_wrapper.gemspec
|
113
|
+
- spec/fixtures/basic_configs/_rest_managed.json
|
114
|
+
- spec/fixtures/basic_configs/currency.xml
|
115
|
+
- spec/fixtures/basic_configs/lang/stopwords_en.txt
|
116
|
+
- spec/fixtures/basic_configs/protwords.txt
|
117
|
+
- spec/fixtures/basic_configs/schema.xml
|
118
|
+
- spec/fixtures/basic_configs/solrconfig.xml
|
119
|
+
- spec/fixtures/basic_configs/stopwords.txt
|
120
|
+
- spec/fixtures/basic_configs/synonyms.txt
|
121
|
+
- spec/lib/solr_wrapper/instance_spec.rb
|
122
|
+
- spec/lib/solr_wrapper_spec.rb
|
123
|
+
- spec/spec_helper.rb
|
124
|
+
homepage: ''
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata: {}
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project:
|
144
|
+
rubygems_version: 2.4.5
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: Solr 5 service wrapper
|
148
|
+
test_files:
|
149
|
+
- spec/fixtures/basic_configs/_rest_managed.json
|
150
|
+
- spec/fixtures/basic_configs/currency.xml
|
151
|
+
- spec/fixtures/basic_configs/lang/stopwords_en.txt
|
152
|
+
- spec/fixtures/basic_configs/protwords.txt
|
153
|
+
- spec/fixtures/basic_configs/schema.xml
|
154
|
+
- spec/fixtures/basic_configs/solrconfig.xml
|
155
|
+
- spec/fixtures/basic_configs/stopwords.txt
|
156
|
+
- spec/fixtures/basic_configs/synonyms.txt
|
157
|
+
- spec/lib/solr_wrapper/instance_spec.rb
|
158
|
+
- spec/lib/solr_wrapper_spec.rb
|
159
|
+
- spec/spec_helper.rb
|