rroonga 0.9.2-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +5 -0
- data/NEWS.ja.rdoc +114 -0
- data/NEWS.rdoc +116 -0
- data/README.ja.rdoc +65 -0
- data/README.rdoc +66 -0
- data/Rakefile +217 -0
- data/benchmark/common.rb +49 -0
- data/benchmark/read-write-many-small-items.rb +144 -0
- data/benchmark/write-many-small-items.rb +135 -0
- data/example/bookmark.rb +161 -0
- data/example/index-html.rb +89 -0
- data/example/search/config.ru +211 -0
- data/example/search/public/css/groonga.css +122 -0
- data/ext/.gitignore +2 -0
- data/ext/libruby-groonga.a +0 -0
- data/ext/rb-grn-accessor.c +52 -0
- data/ext/rb-grn-array-cursor.c +36 -0
- data/ext/rb-grn-array.c +210 -0
- data/ext/rb-grn-column.c +573 -0
- data/ext/rb-grn-context.c +655 -0
- data/ext/rb-grn-database.c +472 -0
- data/ext/rb-grn-encoding-support.c +64 -0
- data/ext/rb-grn-encoding.c +257 -0
- data/ext/rb-grn-exception.c +1110 -0
- data/ext/rb-grn-expression-builder.c +75 -0
- data/ext/rb-grn-expression.c +735 -0
- data/ext/rb-grn-fix-size-column.c +166 -0
- data/ext/rb-grn-hash-cursor.c +38 -0
- data/ext/rb-grn-hash.c +294 -0
- data/ext/rb-grn-index-column.c +488 -0
- data/ext/rb-grn-logger.c +504 -0
- data/ext/rb-grn-object.c +1369 -0
- data/ext/rb-grn-operation.c +198 -0
- data/ext/rb-grn-patricia-trie-cursor.c +39 -0
- data/ext/rb-grn-patricia-trie.c +488 -0
- data/ext/rb-grn-procedure.c +52 -0
- data/ext/rb-grn-query.c +260 -0
- data/ext/rb-grn-record.c +40 -0
- data/ext/rb-grn-snippet.c +334 -0
- data/ext/rb-grn-table-cursor-key-support.c +69 -0
- data/ext/rb-grn-table-cursor.c +247 -0
- data/ext/rb-grn-table-key-support.c +731 -0
- data/ext/rb-grn-table.c +2141 -0
- data/ext/rb-grn-type.c +181 -0
- data/ext/rb-grn-utils.c +769 -0
- data/ext/rb-grn-variable-size-column.c +36 -0
- data/ext/rb-grn-variable.c +108 -0
- data/ext/rb-grn-view-accessor.c +53 -0
- data/ext/rb-grn-view-cursor.c +35 -0
- data/ext/rb-grn-view-record.c +41 -0
- data/ext/rb-grn-view.c +421 -0
- data/ext/rb-grn.h +700 -0
- data/ext/rb-groonga.c +117 -0
- data/extconf.rb +266 -0
- data/html/bar.svg +153 -0
- data/html/developer.html +117 -0
- data/html/developer.svg +469 -0
- data/html/download.svg +253 -0
- data/html/favicon.ico +0 -0
- data/html/favicon.xcf +0 -0
- data/html/footer.html.erb +28 -0
- data/html/head.html.erb +4 -0
- data/html/header.html.erb +17 -0
- data/html/index.html +147 -0
- data/html/install.svg +636 -0
- data/html/logo.xcf +0 -0
- data/html/ranguba.css +250 -0
- data/html/tutorial.svg +559 -0
- data/lib/groonga.rb +90 -0
- data/lib/groonga/context.rb +184 -0
- data/lib/groonga/expression-builder.rb +285 -0
- data/lib/groonga/patricia-trie.rb +53 -0
- data/lib/groonga/record.rb +311 -0
- data/lib/groonga/schema.rb +1191 -0
- data/lib/groonga/view-record.rb +56 -0
- data/license/GPL +340 -0
- data/license/LGPL +504 -0
- data/license/RUBY +59 -0
- data/misc/grnop2ruby.rb +49 -0
- data/pkg-config.rb +333 -0
- data/test-unit/Rakefile +40 -0
- data/test-unit/TODO +5 -0
- data/test-unit/bin/testrb +5 -0
- data/test-unit/html/classic.html +15 -0
- data/test-unit/html/index.html +25 -0
- data/test-unit/html/index.html.ja +27 -0
- data/test-unit/lib/test/unit.rb +323 -0
- data/test-unit/lib/test/unit/assertionfailederror.rb +25 -0
- data/test-unit/lib/test/unit/assertions.rb +1230 -0
- data/test-unit/lib/test/unit/attribute.rb +125 -0
- data/test-unit/lib/test/unit/autorunner.rb +360 -0
- data/test-unit/lib/test/unit/collector.rb +36 -0
- data/test-unit/lib/test/unit/collector/descendant.rb +23 -0
- data/test-unit/lib/test/unit/collector/dir.rb +108 -0
- data/test-unit/lib/test/unit/collector/load.rb +136 -0
- data/test-unit/lib/test/unit/collector/objectspace.rb +34 -0
- data/test-unit/lib/test/unit/color-scheme.rb +102 -0
- data/test-unit/lib/test/unit/color.rb +96 -0
- data/test-unit/lib/test/unit/diff.rb +724 -0
- data/test-unit/lib/test/unit/error.rb +130 -0
- data/test-unit/lib/test/unit/exceptionhandler.rb +39 -0
- data/test-unit/lib/test/unit/failure.rb +136 -0
- data/test-unit/lib/test/unit/fixture.rb +176 -0
- data/test-unit/lib/test/unit/notification.rb +129 -0
- data/test-unit/lib/test/unit/omission.rb +191 -0
- data/test-unit/lib/test/unit/pending.rb +150 -0
- data/test-unit/lib/test/unit/priority.rb +180 -0
- data/test-unit/lib/test/unit/runner/console.rb +52 -0
- data/test-unit/lib/test/unit/runner/emacs.rb +8 -0
- data/test-unit/lib/test/unit/runner/tap.rb +8 -0
- data/test-unit/lib/test/unit/testcase.rb +476 -0
- data/test-unit/lib/test/unit/testresult.rb +89 -0
- data/test-unit/lib/test/unit/testsuite.rb +110 -0
- data/test-unit/lib/test/unit/ui/console/outputlevel.rb +14 -0
- data/test-unit/lib/test/unit/ui/console/testrunner.rb +466 -0
- data/test-unit/lib/test/unit/ui/emacs/testrunner.rb +63 -0
- data/test-unit/lib/test/unit/ui/tap/testrunner.rb +92 -0
- data/test-unit/lib/test/unit/ui/testrunner.rb +28 -0
- data/test-unit/lib/test/unit/ui/testrunnermediator.rb +77 -0
- data/test-unit/lib/test/unit/ui/testrunnerutilities.rb +41 -0
- data/test-unit/lib/test/unit/util/backtracefilter.rb +41 -0
- data/test-unit/lib/test/unit/util/method-owner-finder.rb +28 -0
- data/test-unit/lib/test/unit/util/observable.rb +90 -0
- data/test-unit/lib/test/unit/util/procwrapper.rb +48 -0
- data/test-unit/lib/test/unit/version.rb +7 -0
- data/test-unit/sample/adder.rb +13 -0
- data/test-unit/sample/subtracter.rb +12 -0
- data/test-unit/sample/test_adder.rb +20 -0
- data/test-unit/sample/test_subtracter.rb +20 -0
- data/test-unit/sample/test_user.rb +23 -0
- data/test-unit/test/collector/test-descendant.rb +133 -0
- data/test-unit/test/collector/test-load.rb +348 -0
- data/test-unit/test/collector/test_dir.rb +406 -0
- data/test-unit/test/collector/test_objectspace.rb +100 -0
- data/test-unit/test/run-test.rb +15 -0
- data/test-unit/test/test-attribute.rb +86 -0
- data/test-unit/test/test-color-scheme.rb +67 -0
- data/test-unit/test/test-color.rb +47 -0
- data/test-unit/test/test-diff.rb +518 -0
- data/test-unit/test/test-emacs-runner.rb +60 -0
- data/test-unit/test/test-fixture.rb +287 -0
- data/test-unit/test/test-notification.rb +33 -0
- data/test-unit/test/test-omission.rb +81 -0
- data/test-unit/test/test-pending.rb +70 -0
- data/test-unit/test/test-priority.rb +119 -0
- data/test-unit/test/test-testcase.rb +544 -0
- data/test-unit/test/test_assertions.rb +1151 -0
- data/test-unit/test/test_error.rb +26 -0
- data/test-unit/test/test_failure.rb +33 -0
- data/test-unit/test/test_testresult.rb +113 -0
- data/test-unit/test/test_testsuite.rb +129 -0
- data/test-unit/test/testunit-test-util.rb +14 -0
- data/test-unit/test/ui/test_testrunmediator.rb +20 -0
- data/test-unit/test/util/test-method-owner-finder.rb +38 -0
- data/test-unit/test/util/test_backtracefilter.rb +41 -0
- data/test-unit/test/util/test_observable.rb +102 -0
- data/test-unit/test/util/test_procwrapper.rb +36 -0
- data/test/.gitignore +1 -0
- data/test/groonga-test-utils.rb +133 -0
- data/test/run-test.rb +58 -0
- data/test/test-array.rb +97 -0
- data/test/test-column.rb +316 -0
- data/test/test-context-select.rb +93 -0
- data/test/test-context.rb +73 -0
- data/test/test-database.rb +113 -0
- data/test/test-encoding.rb +33 -0
- data/test/test-exception.rb +93 -0
- data/test/test-expression-builder.rb +156 -0
- data/test/test-expression.rb +134 -0
- data/test/test-fix-size-column.rb +65 -0
- data/test/test-gqtp.rb +72 -0
- data/test/test-hash.rb +312 -0
- data/test/test-index-column.rb +81 -0
- data/test/test-logger.rb +37 -0
- data/test/test-patricia-trie.rb +189 -0
- data/test/test-procedure.rb +37 -0
- data/test/test-query.rb +22 -0
- data/test/test-record.rb +279 -0
- data/test/test-remote.rb +54 -0
- data/test/test-schema-view.rb +90 -0
- data/test/test-schema.rb +459 -0
- data/test/test-snippet.rb +130 -0
- data/test/test-table-cursor.rb +153 -0
- data/test/test-table-offset-and-limit.rb +102 -0
- data/test/test-table-select-normalize.rb +53 -0
- data/test/test-table-select.rb +150 -0
- data/test/test-table.rb +690 -0
- data/test/test-type.rb +71 -0
- data/test/test-variable-size-column.rb +98 -0
- data/test/test-variable.rb +28 -0
- data/test/test-vector-column.rb +76 -0
- data/test/test-version.rb +31 -0
- data/test/test-view.rb +72 -0
- data/text/TUTORIAL.ja.rdoc +392 -0
- data/text/expression.rdoc +284 -0
- data/vendor/local/bin/grntest.exe +0 -0
- data/vendor/local/bin/groonga.exe +0 -0
- data/vendor/local/bin/libgroonga.dll +0 -0
- data/vendor/local/bin/libmecab.dll +0 -0
- data/vendor/local/include/groonga.h +2285 -0
- data/vendor/local/lib/libgroonga.lib +0 -0
- metadata +280 -0
@@ -0,0 +1,89 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
if ARGV.size < 2 or ARGV.find {|option| option == "-h" or option == "--help"}
|
4
|
+
puts "Usage: #{$0} DATABASE_FILE [FILE_OR_DIRECTORY ...]"
|
5
|
+
exit
|
6
|
+
end
|
7
|
+
|
8
|
+
require 'pathname'
|
9
|
+
|
10
|
+
base_directory = Pathname(__FILE__).dirname + ".."
|
11
|
+
$LOAD_PATH.unshift((base_directory + "ext").to_s)
|
12
|
+
$LOAD_PATH.unshift((base_directory + "lib").to_s)
|
13
|
+
|
14
|
+
require 'rubygems'
|
15
|
+
require 'groonga'
|
16
|
+
require 'nokogiri'
|
17
|
+
|
18
|
+
database_file, *targets = ARGV
|
19
|
+
|
20
|
+
database_file = Pathname(database_file)
|
21
|
+
database_directory = database_file.dirname
|
22
|
+
database_directory.mkpath unless database_directory.exist?
|
23
|
+
|
24
|
+
if database_file.exist?
|
25
|
+
Groonga::Database.open(database_file.to_s)
|
26
|
+
else
|
27
|
+
Groonga::Database.create(:path => database_file.to_s)
|
28
|
+
Groonga::Schema.define do |schema|
|
29
|
+
schema.create_table("documents") do |table|
|
30
|
+
table.string("title")
|
31
|
+
table.text("content")
|
32
|
+
table.string("path")
|
33
|
+
table.time("last-modified")
|
34
|
+
end
|
35
|
+
|
36
|
+
schema.create_table("terms",
|
37
|
+
:type => :patricia_trie,
|
38
|
+
:key_normalize => true,
|
39
|
+
:default_tokenizer => "TokenBigram") do |table|
|
40
|
+
table.index("documents.title")
|
41
|
+
table.index("documents.content")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
documents = Groonga::Context.default["documents"]
|
47
|
+
|
48
|
+
targets.each do |target|
|
49
|
+
target = Pathname(target)
|
50
|
+
target.find do |path|
|
51
|
+
throw :prune if path.basename.to_s == ".svn"
|
52
|
+
if path.file? and path.extname == ".html"
|
53
|
+
path.open do |html|
|
54
|
+
values = {:path => path.relative_path_from(target).to_s}
|
55
|
+
_documents = documents.select do |record|
|
56
|
+
record["path"] == values[:path]
|
57
|
+
end
|
58
|
+
if _documents.size.zero?
|
59
|
+
document = documents.add
|
60
|
+
else
|
61
|
+
document = _documents.to_a[0].key
|
62
|
+
end
|
63
|
+
|
64
|
+
html_document = Nokogiri::HTML(html)
|
65
|
+
html_document.css("title").each do |title|
|
66
|
+
values[:title] = title.text
|
67
|
+
end
|
68
|
+
contents = []
|
69
|
+
html_document.css("body").each do |body|
|
70
|
+
contents << body.text
|
71
|
+
end
|
72
|
+
html_document.css("img").each do |image|
|
73
|
+
image_content = []
|
74
|
+
title = image['title']
|
75
|
+
alt = image['alt']
|
76
|
+
image_content << title if title and !title.empty?
|
77
|
+
image_content << alt if alt and !alt.empty?
|
78
|
+
contents.concat(image_content) unless image_content.empty?
|
79
|
+
end
|
80
|
+
values[:content] = contents.join("\n")
|
81
|
+
values["last-modified"] = path.mtime
|
82
|
+
|
83
|
+
values.each do |key, value|
|
84
|
+
document[key] = value
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,211 @@
|
|
1
|
+
# -*- mode: ruby; coding: utf-8 -*-
|
2
|
+
|
3
|
+
base_dir = File.join(File.dirname(__FILE__), "..", "..")
|
4
|
+
$LOAD_PATH.unshift(File.join(base_dir, "ext"))
|
5
|
+
$LOAD_PATH.unshift(File.join(base_dir, "lib"))
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rack'
|
9
|
+
require 'groonga'
|
10
|
+
|
11
|
+
use Rack::CommonLogger
|
12
|
+
use Rack::Static, :urls => ["/css", "/images"], :root => "public"
|
13
|
+
|
14
|
+
Groonga::Database.new("data/database")
|
15
|
+
|
16
|
+
class Searcher
|
17
|
+
include Rack::Utils
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@documents = Groonga::Context.default["documents"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def call(env)
|
24
|
+
request = Rack::Request.new(env)
|
25
|
+
response = Rack::Response.new
|
26
|
+
response["Content-Type"] = "text/html; charset=UTF-8"
|
27
|
+
if /\/\z/ !~ request.path_info
|
28
|
+
request.path_info += "/"
|
29
|
+
response.redirect(request.url)
|
30
|
+
return response.to_a
|
31
|
+
end
|
32
|
+
|
33
|
+
response.write(<<-EOH)
|
34
|
+
<?xml version="1.0" encoding="utf-8"?>
|
35
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
36
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
37
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">
|
38
|
+
<head>
|
39
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
40
|
+
<meta name="robot" content="noindex,nofollow" />
|
41
|
+
<title>groongaで全文検索</title>
|
42
|
+
<link rel="stylesheet" href="css/groonga.css" type="text/css" media="all" />
|
43
|
+
</head>
|
44
|
+
<body>
|
45
|
+
<div class="header">
|
46
|
+
<h1>groongaで全文検索</h1>
|
47
|
+
</div>
|
48
|
+
|
49
|
+
<div class="content">
|
50
|
+
EOH
|
51
|
+
|
52
|
+
render_search_box(request, response)
|
53
|
+
render_search_result(request, response)
|
54
|
+
|
55
|
+
response.write(<<-EOF)
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div class="footer">
|
59
|
+
<p class="powered-by-groonga">
|
60
|
+
<a href="http://groonga.org/">groonga</a>
|
61
|
+
#{Groonga::VERSION.join('.')}を使っています。
|
62
|
+
</p>
|
63
|
+
<p class="powered-by-ruby-groonga">
|
64
|
+
<a href="http://groonga.rubyforge.org/">Ruby/groonga</a>
|
65
|
+
#{Groonga::BINDINGS_VERSION.join('.')}を使っています。
|
66
|
+
</p>
|
67
|
+
</div>
|
68
|
+
|
69
|
+
</body>
|
70
|
+
</html>
|
71
|
+
EOF
|
72
|
+
response.to_a
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
def query(request)
|
77
|
+
request['query'] || ''
|
78
|
+
end
|
79
|
+
|
80
|
+
def page(request)
|
81
|
+
(request['page'] || 0).to_i
|
82
|
+
end
|
83
|
+
|
84
|
+
def render_search_box(request, response)
|
85
|
+
response.write(<<-EOF)
|
86
|
+
<form method="get" action="./">
|
87
|
+
<p>
|
88
|
+
<a href="."><img src="images/mini-groonga.png" alt="groonga" /></a>
|
89
|
+
<input name="query" type="text" value="#{escape_html(query(request))}" />
|
90
|
+
<input type="submit" value="検索" />
|
91
|
+
</p>
|
92
|
+
</form>
|
93
|
+
EOF
|
94
|
+
end
|
95
|
+
|
96
|
+
def render_search_result(request, response)
|
97
|
+
_query = query(request)
|
98
|
+
_page = page(request)
|
99
|
+
limit = 20
|
100
|
+
if _query.empty?
|
101
|
+
records = []
|
102
|
+
response.write(<<-EOS)
|
103
|
+
<div class='search-summary'>
|
104
|
+
<p>Rubyでgroonga使って全文検索</p>
|
105
|
+
</div>
|
106
|
+
EOS
|
107
|
+
else
|
108
|
+
options = {}
|
109
|
+
before = Time.now
|
110
|
+
records = @documents.select do |record|
|
111
|
+
record["content"].match(_query)
|
112
|
+
end
|
113
|
+
total_records = records.size
|
114
|
+
records = records.sort([["_score", "descending"],
|
115
|
+
["last-modified", "descending"]],
|
116
|
+
:offset => _page * limit,
|
117
|
+
:limit => limit)
|
118
|
+
elapsed = Time.now - before
|
119
|
+
|
120
|
+
response.write(<<-EOS)
|
121
|
+
<div class='search-summary'>
|
122
|
+
<p>
|
123
|
+
<span class="keyword">#{escape_html(query(request))}</span>の検索結果:
|
124
|
+
<span class="total-entries">#{total_records}</span>件中
|
125
|
+
<span class="display-range">
|
126
|
+
#{total_records.zero? ? 0 : (_page * limit) + 1}
|
127
|
+
-
|
128
|
+
#{(_page * limit) + records.size}
|
129
|
+
</span>
|
130
|
+
件(#{elapsed}秒)
|
131
|
+
</p>
|
132
|
+
</div>
|
133
|
+
EOS
|
134
|
+
end
|
135
|
+
|
136
|
+
response.write(" <div class='records'>\n")
|
137
|
+
records.each do |record|
|
138
|
+
render_record(request, response, record)
|
139
|
+
end
|
140
|
+
response.write(" </div>\n")
|
141
|
+
|
142
|
+
render_pagination(request, response, _page, limit, total_records)
|
143
|
+
end
|
144
|
+
|
145
|
+
def render_record(request, response, record)
|
146
|
+
response.write(" <div class='record'>\n")
|
147
|
+
href = escape_html(record['.path'])
|
148
|
+
title = escape_html(record['.title'])
|
149
|
+
last_modified = escape_html(record['.last-modified'].iso8601)
|
150
|
+
score = record.score
|
151
|
+
response.write(" <h2><a href='#{href}'>#{title}</a>(#{score})</h2>\n")
|
152
|
+
render_snippet(request, response, record)
|
153
|
+
response.write(<<-EOM)
|
154
|
+
<p class="metadata">
|
155
|
+
<span class="url">#{unescape(href)}</span>
|
156
|
+
-
|
157
|
+
<span class="last-modified">#{last_modified}</span>
|
158
|
+
</p>
|
159
|
+
EOM
|
160
|
+
response.write(" </div>\n")
|
161
|
+
end
|
162
|
+
|
163
|
+
def render_snippet(request, response, record)
|
164
|
+
expression = record.table.expression
|
165
|
+
snippet = expression.snippet([["<span class=\"keyword\">", "</span>"]],
|
166
|
+
:width => 100,
|
167
|
+
:html_escape => true,
|
168
|
+
:normalize => true)
|
169
|
+
separator = "\n<span class='separator'>...</span>\n"
|
170
|
+
response.write(<<-EOS)
|
171
|
+
<p class="snippet">
|
172
|
+
#{snippet.execute(record[".content"]).join(separator)}
|
173
|
+
</p>
|
174
|
+
EOS
|
175
|
+
end
|
176
|
+
|
177
|
+
def render_pagination(request, response, page, limit, total_records)
|
178
|
+
_query = query(request)
|
179
|
+
return if _query.empty?
|
180
|
+
|
181
|
+
return if total_records < limit
|
182
|
+
|
183
|
+
last_page = (total_records / limit.to_f).ceil
|
184
|
+
response.write("<div class='pagination'>\n")
|
185
|
+
if page > 0
|
186
|
+
render_pagination_link(request, response, _query, page - 1, "<<")
|
187
|
+
end
|
188
|
+
last_page.times do |i|
|
189
|
+
if i == page
|
190
|
+
response.write(pagination_span(escape_html(i)))
|
191
|
+
else
|
192
|
+
render_pagination_link(request, response, _query, i, i)
|
193
|
+
end
|
194
|
+
end
|
195
|
+
if page < (last_page - 1)
|
196
|
+
render_pagination_link(request, response, _query, page + 1, ">>")
|
197
|
+
end
|
198
|
+
response.write("</div>\n")
|
199
|
+
end
|
200
|
+
|
201
|
+
def render_pagination_link(request, response, query, page, label)
|
202
|
+
href = "./?query=#{escape_html(query)};page=#{escape_html(page)}"
|
203
|
+
response.write(pagination_span("<a href='#{href}'>#{label}</a>"))
|
204
|
+
end
|
205
|
+
|
206
|
+
def pagination_span(content)
|
207
|
+
"<span class='pagination-link'>#{content}</span>\n"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
run Searcher.new
|
@@ -0,0 +1,122 @@
|
|
1
|
+
body
|
2
|
+
{
|
3
|
+
background-color: #fff;
|
4
|
+
color: #000;
|
5
|
+
}
|
6
|
+
|
7
|
+
div.header
|
8
|
+
{
|
9
|
+
display: none;
|
10
|
+
}
|
11
|
+
|
12
|
+
div.search-box
|
13
|
+
{
|
14
|
+
width: 100%;
|
15
|
+
text-align: center;
|
16
|
+
}
|
17
|
+
|
18
|
+
div.re-search
|
19
|
+
{
|
20
|
+
}
|
21
|
+
|
22
|
+
div.search-summary
|
23
|
+
{
|
24
|
+
font-size: small;
|
25
|
+
border-top: 1px solid #fc3;
|
26
|
+
background-color: #ffd;
|
27
|
+
}
|
28
|
+
|
29
|
+
div.search-summary p
|
30
|
+
{
|
31
|
+
padding: 3px;
|
32
|
+
margin: 0;
|
33
|
+
}
|
34
|
+
|
35
|
+
div.records
|
36
|
+
{
|
37
|
+
font-size: smaller;
|
38
|
+
padding-top: 10px;
|
39
|
+
padding-left: 30px;
|
40
|
+
margin-right: 20%;
|
41
|
+
margin-bottom: 30px;
|
42
|
+
}
|
43
|
+
|
44
|
+
div.records h2
|
45
|
+
{
|
46
|
+
padding: 0;
|
47
|
+
margin-bottom: 5px;
|
48
|
+
}
|
49
|
+
|
50
|
+
div.records p
|
51
|
+
{
|
52
|
+
}
|
53
|
+
|
54
|
+
p.snippet
|
55
|
+
{
|
56
|
+
padding: 0;
|
57
|
+
margin: 0;
|
58
|
+
}
|
59
|
+
|
60
|
+
p.snippet span.separator
|
61
|
+
{
|
62
|
+
font-weight: bold;
|
63
|
+
}
|
64
|
+
|
65
|
+
span.keyword,
|
66
|
+
span.total-entries,
|
67
|
+
span.display-range
|
68
|
+
{
|
69
|
+
font-weight: bold;
|
70
|
+
}
|
71
|
+
|
72
|
+
div.pagination
|
73
|
+
{
|
74
|
+
text-align: center;
|
75
|
+
margin-bottom: 20px;
|
76
|
+
}
|
77
|
+
|
78
|
+
p.metadata
|
79
|
+
{
|
80
|
+
padding: 0;
|
81
|
+
margin: 0;
|
82
|
+
margin-top: 5px;
|
83
|
+
}
|
84
|
+
|
85
|
+
span.url
|
86
|
+
{
|
87
|
+
color: green;
|
88
|
+
}
|
89
|
+
|
90
|
+
pre
|
91
|
+
{
|
92
|
+
overflow: auto;
|
93
|
+
margin: 20px 30px;
|
94
|
+
padding: 10px;
|
95
|
+
border-top: 1px solid #fc3;
|
96
|
+
background-color: #ffd;
|
97
|
+
}
|
98
|
+
|
99
|
+
a img
|
100
|
+
{
|
101
|
+
border-style: none;
|
102
|
+
}
|
103
|
+
|
104
|
+
ul.sources li
|
105
|
+
{
|
106
|
+
display: inline;
|
107
|
+
}
|
108
|
+
|
109
|
+
div.footer
|
110
|
+
{
|
111
|
+
border-top: 1px solid #fc3;
|
112
|
+
background-color: #ffd;
|
113
|
+
margin-top: 5px;
|
114
|
+
text-align: right;
|
115
|
+
}
|
116
|
+
|
117
|
+
div.footer p
|
118
|
+
{
|
119
|
+
font-size: small;
|
120
|
+
padding: 0;
|
121
|
+
margin: 0;
|
122
|
+
}
|
data/ext/.gitignore
ADDED
Binary file
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/* -*- c-file-style: "ruby" -*- */
|
2
|
+
/*
|
3
|
+
Copyright (C) 2009 Kouhei Sutou <kou@clear-code.com>
|
4
|
+
|
5
|
+
This library is free software; you can redistribute it and/or
|
6
|
+
modify it under the terms of the GNU Lesser General Public
|
7
|
+
License version 2.1 as published by the Free Software Foundation.
|
8
|
+
|
9
|
+
This library is distributed in the hope that it will be useful,
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
12
|
+
Lesser General Public License for more details.
|
13
|
+
|
14
|
+
You should have received a copy of the GNU Lesser General Public
|
15
|
+
License along with this library; if not, write to the Free Software
|
16
|
+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
17
|
+
*/
|
18
|
+
|
19
|
+
#include "rb-grn.h"
|
20
|
+
|
21
|
+
#define SELF(object) (RVAL2GRNACCESSOR(object))
|
22
|
+
|
23
|
+
VALUE rb_cGrnAccessor;
|
24
|
+
|
25
|
+
grn_obj *
|
26
|
+
rb_grn_accessor_from_ruby_object (VALUE object)
|
27
|
+
{
|
28
|
+
if (!RVAL2CBOOL(rb_obj_is_kind_of(object, rb_cGrnAccessor))) {
|
29
|
+
rb_raise(rb_eTypeError, "not a groonga accessor");
|
30
|
+
}
|
31
|
+
|
32
|
+
return RVAL2GRNOBJECT(object, NULL);
|
33
|
+
}
|
34
|
+
|
35
|
+
VALUE
|
36
|
+
rb_grn_accessor_to_ruby_object (grn_ctx *context, grn_obj *table,
|
37
|
+
rb_grn_boolean owner)
|
38
|
+
{
|
39
|
+
return GRNOBJECT2RVAL(rb_cGrnAccessor, context, table, owner);
|
40
|
+
}
|
41
|
+
|
42
|
+
/*
|
43
|
+
* Document-class: Groonga::Accessor < Groonga::Object
|
44
|
+
*
|
45
|
+
* キー、値、スコアなど種々の値へのアクセスをカプセル化した
|
46
|
+
* オブジェクト。Groonga::Table#columnで取得できる。
|
47
|
+
*/
|
48
|
+
void
|
49
|
+
rb_grn_init_accessor (VALUE mGrn)
|
50
|
+
{
|
51
|
+
rb_cGrnAccessor = rb_define_class_under(mGrn, "Accessor", rb_cGrnObject);
|
52
|
+
}
|