xapian-rack 1.2.3.3 → 1.2.19.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/README.md +82 -0
- data/Rakefile +2 -0
- data/lib/xapian/rack.rb +3 -0
- data/lib/xapian/rack/version.rb +1 -8
- data/xapian-rack.gemspec +24 -0
- metadata +69 -65
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 56065a2bf4ff484c905e5ea7a20fd593c748fdf7
|
4
|
+
data.tar.gz: b4565e8c7f4b2af0cf9f039644eeb6df70588f0a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b344c28e86f5d40c1b0e242729172ad23a2508fb24825913cc5707ecc28c0f1ee2bbe0e04c96b79b7af66394182ab38e4bd47bc00f7ab7db4655ae56b2a141a0
|
7
|
+
data.tar.gz: f910b65b30ae9fa30966ee849f81250b85ad63872f1b6c2d24657006f3ba71421943e7d60a4486e6a53ba00b51bd4b06a05aeef7fbfd7a620510b5ef317e479e
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Xapian::Rack
|
2
|
+
|
3
|
+
Xapian::Rack provides a rack middleware for indexing both local and external HTML documents.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'xapian-rack'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install xapian-rack
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Add the following middleware:
|
22
|
+
|
23
|
+
use Xapian::Rack::Search,
|
24
|
+
:database => './xapian.db'
|
25
|
+
:roots => ['/']
|
26
|
+
|
27
|
+
The site will be indexed in the background. To perform a search:
|
28
|
+
|
29
|
+
query = request[:query] || ""
|
30
|
+
search = Xapian::Rack.get(request.env)
|
31
|
+
results = Xapian::Rack.find(request.env, query, {:options => Xapian::QueryParser::FLAG_WILDCARD})
|
32
|
+
|
33
|
+
# Output:
|
34
|
+
<p>Approximately #{results.matches_estimated} results found out of #{search.database.doccount} total.</p>
|
35
|
+
|
36
|
+
<dl class="search-results">
|
37
|
+
<?r
|
38
|
+
results.matches.each do |m|
|
39
|
+
resource = YAML::load(m.document.data)
|
40
|
+
metadata = resource[:metadata]
|
41
|
+
?>
|
42
|
+
<dt><a href="#{resource[:name].to_html}">#{metadata[:title].to_html}</a> (#{m.percent}% relevance)</dt>
|
43
|
+
<?r if metadata[:description] ?>
|
44
|
+
<dd>#{metadata[:description].to_html}</dd>
|
45
|
+
<dd class="href">#{URI.parse("http://www.oriontransfer.co.nz/") + resource[:name]}</dd>
|
46
|
+
<?r end ?>
|
47
|
+
<?r
|
48
|
+
end
|
49
|
+
?>
|
50
|
+
</dl>
|
51
|
+
|
52
|
+
## Contributing
|
53
|
+
|
54
|
+
1. Fork it
|
55
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
56
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
57
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
58
|
+
5. Create new Pull Request
|
59
|
+
|
60
|
+
## License
|
61
|
+
|
62
|
+
This code is dual licensed under the MIT license and GPLv3 license.
|
63
|
+
|
64
|
+
Copyright, 2015, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
65
|
+
|
66
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
67
|
+
of this software and associated documentation files (the "Software"), to deal
|
68
|
+
in the Software without restriction, including without limitation the rights
|
69
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
70
|
+
copies of the Software, and to permit persons to whom the Software is
|
71
|
+
furnished to do so, subject to the following conditions:
|
72
|
+
|
73
|
+
The above copyright notice and this permission notice shall be included in
|
74
|
+
all copies or substantial portions of the Software.
|
75
|
+
|
76
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
77
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
78
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
79
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
80
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
81
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
82
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
data/lib/xapian/rack.rb
ADDED
data/lib/xapian/rack/version.rb
CHANGED
data/xapian-rack.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'xapian/rack/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "xapian-rack"
|
8
|
+
spec.version = Xapian::Rack::VERSION
|
9
|
+
spec.authors = ["Samuel Williams"]
|
10
|
+
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
11
|
+
spec.summary = %q{Xapian::Rack provides indexing and searching integration with Rack.}
|
12
|
+
spec.homepage = ""
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_dependency "xapian-indexer", "~> 1.2.19.2"
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
end
|
metadata
CHANGED
@@ -1,91 +1,95 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: xapian-rack
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 1
|
7
|
-
- 2
|
8
|
-
- 3
|
9
|
-
- 3
|
10
|
-
version: 1.2.3.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.2.19.1
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Samuel Williams
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
11
|
+
date: 2015-01-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: xapian-indexer
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.2.19.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.2.19.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
23
35
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
27
45
|
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
31
|
-
version: "0"
|
32
|
-
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: xapian-indexer
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
36
49
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
40
52
|
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
|
43
|
-
- 0
|
44
|
-
version: "0"
|
45
|
-
type: :runtime
|
46
|
-
version_requirements: *id002
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
47
55
|
description:
|
48
|
-
email:
|
56
|
+
email:
|
57
|
+
- samuel.williams@oriontransfer.co.nz
|
49
58
|
executables: []
|
50
|
-
|
51
59
|
extensions: []
|
52
|
-
|
53
60
|
extra_rdoc_files: []
|
54
|
-
|
55
|
-
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- Gemfile
|
64
|
+
- README.md
|
65
|
+
- Rakefile
|
66
|
+
- lib/xapian/rack.rb
|
56
67
|
- lib/xapian/rack/search.rb
|
57
68
|
- lib/xapian/rack/version.rb
|
58
|
-
|
59
|
-
homepage:
|
60
|
-
licenses:
|
61
|
-
|
69
|
+
- xapian-rack.gemspec
|
70
|
+
homepage: ''
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
metadata: {}
|
62
74
|
post_install_message:
|
63
75
|
rdoc_options: []
|
64
|
-
|
65
|
-
require_paths:
|
76
|
+
require_paths:
|
66
77
|
- lib
|
67
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
-
|
69
|
-
requirements:
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
70
80
|
- - ">="
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
-
none: false
|
77
|
-
requirements:
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
78
85
|
- - ">="
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
|
81
|
-
- 0
|
82
|
-
version: "0"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
83
88
|
requirements: []
|
84
|
-
|
85
89
|
rubyforge_project:
|
86
|
-
rubygems_version:
|
90
|
+
rubygems_version: 2.2.2
|
87
91
|
signing_key:
|
88
|
-
specification_version:
|
92
|
+
specification_version: 4
|
89
93
|
summary: Xapian::Rack provides indexing and searching integration with Rack.
|
90
94
|
test_files: []
|
91
|
-
|
95
|
+
has_rdoc:
|