droonga-engine 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.dir-locals.el +3 -0
- data/.gitignore +6 -0
- data/.travis.yml +15 -0
- data/.yardopts +7 -0
- data/Gemfile +66 -0
- data/LICENSE.txt +14 -0
- data/README.md +17 -0
- data/Rakefile +64 -0
- data/benchmark/benchmark.rb +123 -0
- data/benchmark/utils.rb +246 -0
- data/benchmark/watch/benchmark-notify.rb +143 -0
- data/benchmark/watch/benchmark-notify.sh +20 -0
- data/benchmark/watch/benchmark-publish.rb +120 -0
- data/benchmark/watch/benchmark-scan.rb +213 -0
- data/bin/droonga-catalog-generate +103 -0
- data/bin/droonga-engine +20 -0
- data/bin/droonga-engine-service +20 -0
- data/doc/text/news.md +106 -0
- data/droonga-engine.gemspec +52 -0
- data/lib/droonga/adapter.rb +48 -0
- data/lib/droonga/adapter_runner.rb +104 -0
- data/lib/droonga/catalog/base.rb +41 -0
- data/lib/droonga/catalog/collection_volume.rb +106 -0
- data/lib/droonga/catalog/dataset.rb +69 -0
- data/lib/droonga/catalog/errors.rb +113 -0
- data/lib/droonga/catalog/schema.rb +186 -0
- data/lib/droonga/catalog/single_volume.rb +28 -0
- data/lib/droonga/catalog/slice.rb +41 -0
- data/lib/droonga/catalog/version1.rb +427 -0
- data/lib/droonga/catalog/version2.rb +96 -0
- data/lib/droonga/catalog/version2_validator.rb +63 -0
- data/lib/droonga/catalog/volume.rb +33 -0
- data/lib/droonga/catalog/volume_collection.rb +56 -0
- data/lib/droonga/catalog_generator.rb +156 -0
- data/lib/droonga/catalog_loader.rb +56 -0
- data/lib/droonga/catalog_observer.rb +83 -0
- data/lib/droonga/collector.rb +38 -0
- data/lib/droonga/collector_message.rb +71 -0
- data/lib/droonga/collector_runner.rb +64 -0
- data/lib/droonga/collectors/and.rb +26 -0
- data/lib/droonga/collectors/or.rb +26 -0
- data/lib/droonga/collectors/sum.rb +26 -0
- data/lib/droonga/collectors.rb +18 -0
- data/lib/droonga/dispatcher.rb +326 -0
- data/lib/droonga/distributed_command_planner.rb +179 -0
- data/lib/droonga/distributor.rb +87 -0
- data/lib/droonga/engine/command/droonga_engine.rb +441 -0
- data/lib/droonga/engine/version.rb +20 -0
- data/lib/droonga/engine.rb +80 -0
- data/lib/droonga/engine_state.rb +79 -0
- data/lib/droonga/error.rb +73 -0
- data/lib/droonga/error_messages.rb +33 -0
- data/lib/droonga/event_loop.rb +46 -0
- data/lib/droonga/farm.rb +58 -0
- data/lib/droonga/fluent_message_receiver.rb +191 -0
- data/lib/droonga/fluent_message_sender.rb +140 -0
- data/lib/droonga/forwarder.rb +119 -0
- data/lib/droonga/handler.rb +49 -0
- data/lib/droonga/handler_message.rb +61 -0
- data/lib/droonga/handler_messenger.rb +119 -0
- data/lib/droonga/handler_runner.rb +125 -0
- data/lib/droonga/input_message.rb +51 -0
- data/lib/droonga/job_protocol.rb +20 -0
- data/lib/droonga/job_pusher.rb +179 -0
- data/lib/droonga/job_receiver.rb +70 -0
- data/lib/droonga/loggable.rb +29 -0
- data/lib/droonga/logger.rb +142 -0
- data/lib/droonga/message_matcher.rb +109 -0
- data/lib/droonga/output_message.rb +55 -0
- data/lib/droonga/planner.rb +47 -0
- data/lib/droonga/pluggable.rb +31 -0
- data/lib/droonga/plugin/metadata/adapter_input_message.rb +39 -0
- data/lib/droonga/plugin/metadata/adapter_output_message.rb +39 -0
- data/lib/droonga/plugin/metadata/collector_message.rb +39 -0
- data/lib/droonga/plugin/metadata/handler_action.rb +39 -0
- data/lib/droonga/plugin/metadata/input_message.rb +54 -0
- data/lib/droonga/plugin.rb +43 -0
- data/lib/droonga/plugin_loader.rb +63 -0
- data/lib/droonga/plugin_registry.rb +66 -0
- data/lib/droonga/plugins/basic.rb +54 -0
- data/lib/droonga/plugins/crud.rb +145 -0
- data/lib/droonga/plugins/dump.rb +97 -0
- data/lib/droonga/plugins/error.rb +51 -0
- data/lib/droonga/plugins/groonga/column_create.rb +123 -0
- data/lib/droonga/plugins/groonga/column_list.rb +124 -0
- data/lib/droonga/plugins/groonga/column_remove.rb +65 -0
- data/lib/droonga/plugins/groonga/column_rename.rb +67 -0
- data/lib/droonga/plugins/groonga/delete.rb +117 -0
- data/lib/droonga/plugins/groonga/generic_command.rb +105 -0
- data/lib/droonga/plugins/groonga/generic_response.rb +43 -0
- data/lib/droonga/plugins/groonga/select.rb +236 -0
- data/lib/droonga/plugins/groonga/table_create.rb +111 -0
- data/lib/droonga/plugins/groonga/table_list.rb +120 -0
- data/lib/droonga/plugins/groonga/table_remove.rb +57 -0
- data/lib/droonga/plugins/groonga.rb +37 -0
- data/lib/droonga/plugins/search/distributed_search_planner.rb +407 -0
- data/lib/droonga/plugins/search.rb +146 -0
- data/lib/droonga/plugins/watch.rb +178 -0
- data/lib/droonga/processor.rb +63 -0
- data/lib/droonga/reducer.rb +169 -0
- data/lib/droonga/replier.rb +49 -0
- data/lib/droonga/schema_applier.rb +167 -0
- data/lib/droonga/searcher/mecab_filter.rb +67 -0
- data/lib/droonga/searcher.rb +733 -0
- data/lib/droonga/server.rb +45 -0
- data/lib/droonga/session.rb +99 -0
- data/lib/droonga/single_step.rb +68 -0
- data/lib/droonga/single_step_definition.rb +54 -0
- data/lib/droonga/slice.rb +122 -0
- data/lib/droonga/status_code.rb +25 -0
- data/lib/droonga/step_runner.rb +64 -0
- data/lib/droonga/sweeper.rb +42 -0
- data/lib/droonga/test/stub_handler.rb +37 -0
- data/lib/droonga/test/stub_handler_message.rb +35 -0
- data/lib/droonga/test/stub_handler_messenger.rb +34 -0
- data/lib/droonga/test/stub_planner.rb +31 -0
- data/lib/droonga/test.rb +21 -0
- data/lib/droonga/watch_schema.rb +92 -0
- data/lib/droonga/watcher.rb +257 -0
- data/lib/droonga/worker.rb +61 -0
- data/sample/cluster/catalog.json +42 -0
- data/sample/mecab_filter/data.grn +7 -0
- data/sample/mecab_filter/ddl.grn +7 -0
- data/sample/mecab_filter/search_with_mecab_filter.json +21 -0
- data/sample/mecab_filter/search_without_mecab_filter.json +21 -0
- data/test/command/config/default/catalog.json +85 -0
- data/test/command/config/default/fluentd.conf +11 -0
- data/test/command/config/version1/catalog.json +68 -0
- data/test/command/config/version1/fluentd.conf +11 -0
- data/test/command/fixture/documents.jsons +208 -0
- data/test/command/fixture/event.jsons +41 -0
- data/test/command/fixture/user-table-array.jsons +38 -0
- data/test/command/fixture/user-table.jsons +47 -0
- data/test/command/run-test.rb +34 -0
- data/test/command/suite/add/dimension/column.catalog.json +28 -0
- data/test/command/suite/add/dimension/column.expected +41 -0
- data/test/command/suite/add/dimension/column.test +51 -0
- data/test/command/suite/add/dimension/integer.catalog.json +19 -0
- data/test/command/suite/add/dimension/integer.expected +41 -0
- data/test/command/suite/add/dimension/integer.test +51 -0
- data/test/command/suite/add/error/invalid-integer.expected +46 -0
- data/test/command/suite/add/error/invalid-integer.test +12 -0
- data/test/command/suite/add/error/invalid-time.expected +46 -0
- data/test/command/suite/add/error/invalid-time.test +12 -0
- data/test/command/suite/add/error/missing-key.expected +25 -0
- data/test/command/suite/add/error/missing-key.test +16 -0
- data/test/command/suite/add/error/missing-table.expected +25 -0
- data/test/command/suite/add/error/missing-table.test +16 -0
- data/test/command/suite/add/error/unknown-column.expected +46 -0
- data/test/command/suite/add/error/unknown-column.test +12 -0
- data/test/command/suite/add/error/unknown-table.expected +25 -0
- data/test/command/suite/add/error/unknown-table.test +17 -0
- data/test/command/suite/add/minimum.expected +6 -0
- data/test/command/suite/add/minimum.test +11 -0
- data/test/command/suite/add/with-values.expected +6 -0
- data/test/command/suite/add/with-values.test +17 -0
- data/test/command/suite/add/without-key.expected +6 -0
- data/test/command/suite/add/without-key.test +16 -0
- data/test/command/suite/groonga/column_create/scalar.expected +26 -0
- data/test/command/suite/groonga/column_create/scalar.test +17 -0
- data/test/command/suite/groonga/column_create/unknown-table.expected +14 -0
- data/test/command/suite/groonga/column_create/unknown-table.test +7 -0
- data/test/command/suite/groonga/column_create/vector.expected +26 -0
- data/test/command/suite/groonga/column_create/vector.test +18 -0
- data/test/command/suite/groonga/column_list/success.expected +86 -0
- data/test/command/suite/groonga/column_list/success.test +24 -0
- data/test/command/suite/groonga/column_list/unknown-table.expected +13 -0
- data/test/command/suite/groonga/column_list/unknown-table.test +7 -0
- data/test/command/suite/groonga/column_remove/success.expected +39 -0
- data/test/command/suite/groonga/column_remove/success.test +25 -0
- data/test/command/suite/groonga/column_remove/unknown-column.expected +27 -0
- data/test/command/suite/groonga/column_remove/unknown-column.test +16 -0
- data/test/command/suite/groonga/column_remove/unknown-table.expected +14 -0
- data/test/command/suite/groonga/column_remove/unknown-table.test +7 -0
- data/test/command/suite/groonga/column_rename/success.expected +39 -0
- data/test/command/suite/groonga/column_rename/success.test +26 -0
- data/test/command/suite/groonga/column_rename/unknown-column.expected +27 -0
- data/test/command/suite/groonga/column_rename/unknown-column.test +16 -0
- data/test/command/suite/groonga/column_rename/unknown-table.expected +14 -0
- data/test/command/suite/groonga/column_rename/unknown-table.test +7 -0
- data/test/command/suite/groonga/delete/duplicated-identifiers.expected +27 -0
- data/test/command/suite/groonga/delete/duplicated-identifiers.test +17 -0
- data/test/command/suite/groonga/delete/filter.expected +19 -0
- data/test/command/suite/groonga/delete/filter.test +19 -0
- data/test/command/suite/groonga/delete/invalid-filter.expected +14 -0
- data/test/command/suite/groonga/delete/invalid-filter.test +9 -0
- data/test/command/suite/groonga/delete/no-identifier.expected +27 -0
- data/test/command/suite/groonga/delete/no-identifier.test +15 -0
- data/test/command/suite/groonga/delete/success.expected +19 -0
- data/test/command/suite/groonga/delete/success.test +19 -0
- data/test/command/suite/groonga/delete/unknown-table.expected +14 -0
- data/test/command/suite/groonga/delete/unknown-table.test +7 -0
- data/test/command/suite/groonga/select/minimum.expected +22 -0
- data/test/command/suite/groonga/select/minimum.test +8 -0
- data/test/command/suite/groonga/table_create/array.expected +14 -0
- data/test/command/suite/groonga/table_create/array.test +8 -0
- data/test/command/suite/groonga/table_create/hash.expected +13 -0
- data/test/command/suite/groonga/table_create/hash.test +8 -0
- data/test/command/suite/groonga/table_list/success.expected +71 -0
- data/test/command/suite/groonga/table_list/success.test +15 -0
- data/test/command/suite/groonga/table_remove/success.expected +13 -0
- data/test/command/suite/groonga/table_remove/success.test +8 -0
- data/test/command/suite/groonga/table_remove/unknown-table.expected +14 -0
- data/test/command/suite/groonga/table_remove/unknown-table.test +7 -0
- data/test/command/suite/message/error/missing-dataset.expected +9 -0
- data/test/command/suite/message/error/missing-dataset.test +5 -0
- data/test/command/suite/message/error/unknown-dataset.expected +9 -0
- data/test/command/suite/message/error/unknown-dataset.test +6 -0
- data/test/command/suite/message/error/unknown-type.expected +9 -0
- data/test/command/suite/message/error/unknown-type.test +6 -0
- data/test/command/suite/search/adjusters/multiple.catalog.json +38 -0
- data/test/command/suite/search/adjusters/multiple.expected +19 -0
- data/test/command/suite/search/adjusters/multiple.test +75 -0
- data/test/command/suite/search/adjusters/one.catalog.json +38 -0
- data/test/command/suite/search/adjusters/one.expected +19 -0
- data/test/command/suite/search/adjusters/one.test +66 -0
- data/test/command/suite/search/attributes/array.expected +21 -0
- data/test/command/suite/search/attributes/array.test +28 -0
- data/test/command/suite/search/attributes/hash.expected +30 -0
- data/test/command/suite/search/attributes/hash.test +36 -0
- data/test/command/suite/search/complex.expected +48 -0
- data/test/command/suite/search/complex.test +23 -0
- data/test/command/suite/search/condition/nested.expected +15 -0
- data/test/command/suite/search/condition/nested.test +27 -0
- data/test/command/suite/search/condition/query/nonexistent_column.catalog.json +37 -0
- data/test/command/suite/search/condition/query/nonexistent_column.expected +48 -0
- data/test/command/suite/search/condition/query/nonexistent_column.test +33 -0
- data/test/command/suite/search/condition/query/syntax_error.catalog.json +36 -0
- data/test/command/suite/search/condition/query/syntax_error.expected +48 -0
- data/test/command/suite/search/condition/query/syntax_error.test +33 -0
- data/test/command/suite/search/condition/query.expected +24 -0
- data/test/command/suite/search/condition/query.test +23 -0
- data/test/command/suite/search/condition/script.expected +24 -0
- data/test/command/suite/search/condition/script.test +26 -0
- data/test/command/suite/search/error/cyclic-source.expected +14 -0
- data/test/command/suite/search/error/cyclic-source.test +12 -0
- data/test/command/suite/search/error/deeply-cyclic-source.expected +17 -0
- data/test/command/suite/search/error/deeply-cyclic-source.test +15 -0
- data/test/command/suite/search/error/missing-source-parameter.expected +13 -0
- data/test/command/suite/search/error/missing-source-parameter.test +11 -0
- data/test/command/suite/search/error/no-query.expected +9 -0
- data/test/command/suite/search/error/no-query.test +7 -0
- data/test/command/suite/search/error/unknown-source.expected +52 -0
- data/test/command/suite/search/error/unknown-source.test +12 -0
- data/test/command/suite/search/group/count.expected +10 -0
- data/test/command/suite/search/group/count.test +18 -0
- data/test/command/suite/search/group/limit.expected +15 -0
- data/test/command/suite/search/group/limit.test +20 -0
- data/test/command/suite/search/group/string.expected +32 -0
- data/test/command/suite/search/group/string.test +40 -0
- data/test/command/suite/search/group/subrecord/with-sort.catalog.json +33 -0
- data/test/command/suite/search/group/subrecord/with-sort.expected +30 -0
- data/test/command/suite/search/group/subrecord/with-sort.test +81 -0
- data/test/command/suite/search/multiple/chained.expected +41 -0
- data/test/command/suite/search/multiple/chained.test +39 -0
- data/test/command/suite/search/multiple/parallel.expected +35 -0
- data/test/command/suite/search/multiple/parallel.test +35 -0
- data/test/command/suite/search/output/attributes/invalid.catalog.json +13 -0
- data/test/command/suite/search/output/attributes/invalid.expected +44 -0
- data/test/command/suite/search/output/attributes/invalid.test +28 -0
- data/test/command/suite/search/range/only-output.expected +24 -0
- data/test/command/suite/search/range/only-output.test +23 -0
- data/test/command/suite/search/range/only-sort.expected +24 -0
- data/test/command/suite/search/range/only-sort.test +26 -0
- data/test/command/suite/search/range/sort-and-output.expected +21 -0
- data/test/command/suite/search/range/sort-and-output.test +27 -0
- data/test/command/suite/search/range/too-large-output-offset.expected +12 -0
- data/test/command/suite/search/range/too-large-output-offset.test +23 -0
- data/test/command/suite/search/range/too-large-sort-offset.expected +12 -0
- data/test/command/suite/search/range/too-large-sort-offset.test +26 -0
- data/test/command/suite/search/response/elapsed_time.catalog.json +13 -0
- data/test/command/suite/search/response/elapsed_time.expected +11 -0
- data/test/command/suite/search/response/elapsed_time.test +26 -0
- data/test/command/suite/search/response/records/value/time.expected +20 -0
- data/test/command/suite/search/response/records/value/time.test +22 -0
- data/test/command/suite/search/simple.expected +48 -0
- data/test/command/suite/search/simple.test +22 -0
- data/test/command/suite/search/sort/default-offset-limit.expected +39 -0
- data/test/command/suite/search/sort/default-offset-limit.test +24 -0
- data/test/command/suite/search/sort/invisible-column.expected +24 -0
- data/test/command/suite/search/sort/invisible-column.test +26 -0
- data/test/command/suite/watch/subscribe.expected +6 -0
- data/test/command/suite/watch/subscribe.test +9 -0
- data/test/command/suite/watch/unsubscribe.expected +6 -0
- data/test/command/suite/watch/unsubscribe.test +9 -0
- data/test/performance/run-test.rb +56 -0
- data/test/performance/watch/catalog.json +33 -0
- data/test/performance/watch/feed.json +9 -0
- data/test/performance/watch/fluentd.conf +11 -0
- data/test/performance/watch/subscribe.json +3 -0
- data/test/unit/catalog/test_collection_volume.rb +103 -0
- data/test/unit/catalog/test_dataset.rb +104 -0
- data/test/unit/catalog/test_schema.rb +226 -0
- data/test/unit/catalog/test_single_volume.rb +31 -0
- data/test/unit/catalog/test_slice.rb +92 -0
- data/test/unit/catalog/test_version1.rb +361 -0
- data/test/unit/catalog/test_version2.rb +124 -0
- data/test/unit/catalog/test_version2_validator.rb +66 -0
- data/test/unit/catalog/test_volume_collection.rb +50 -0
- data/test/unit/fixtures/array.grn +18 -0
- data/test/unit/fixtures/catalog/version1.json +40 -0
- data/test/unit/fixtures/catalog/version2.json +62 -0
- data/test/unit/fixtures/document.grn +34 -0
- data/test/unit/fixtures/reference/array.grn +11 -0
- data/test/unit/fixtures/reference/hash.grn +7 -0
- data/test/unit/helper/distributed_search_planner_helper.rb +83 -0
- data/test/unit/helper/fixture.rb +28 -0
- data/test/unit/helper/plugin_helper.rb +38 -0
- data/test/unit/helper/sandbox.rb +86 -0
- data/test/unit/helper/stub_worker.rb +27 -0
- data/test/unit/helper/watch_helper.rb +23 -0
- data/test/unit/helper.rb +28 -0
- data/test/unit/plugins/crud/test_add.rb +190 -0
- data/test/unit/plugins/groonga/select/test_adapter_input.rb +510 -0
- data/test/unit/plugins/groonga/select/test_adapter_output.rb +201 -0
- data/test/unit/plugins/groonga/test_column_create.rb +171 -0
- data/test/unit/plugins/groonga/test_column_list.rb +170 -0
- data/test/unit/plugins/groonga/test_column_remove.rb +98 -0
- data/test/unit/plugins/groonga/test_column_rename.rb +105 -0
- data/test/unit/plugins/groonga/test_delete.rb +127 -0
- data/test/unit/plugins/groonga/test_table_create.rb +147 -0
- data/test/unit/plugins/groonga/test_table_list.rb +184 -0
- data/test/unit/plugins/groonga/test_table_remove.rb +61 -0
- data/test/unit/plugins/search/planner/test_basic.rb +120 -0
- data/test/unit/plugins/search/planner/test_group_by.rb +573 -0
- data/test/unit/plugins/search/planner/test_output.rb +388 -0
- data/test/unit/plugins/search/planner/test_sort_by.rb +938 -0
- data/test/unit/plugins/search/test_collector.rb +806 -0
- data/test/unit/plugins/search/test_handler.rb +930 -0
- data/test/unit/plugins/search/test_planner.rb +174 -0
- data/test/unit/plugins/test_basic.rb +510 -0
- data/test/unit/plugins/test_groonga.rb +70 -0
- data/test/unit/plugins/test_watch.rb +211 -0
- data/test/unit/run-test.rb +56 -0
- data/test/unit/test_catalog_generator.rb +93 -0
- data/test/unit/test_message_matcher.rb +160 -0
- data/test/unit/test_schema_applier.rb +59 -0
- data/test/unit/test_sweeper.rb +95 -0
- data/test/unit/test_watch_schema.rb +57 -0
- data/test/unit/test_watcher.rb +336 -0
- metadata +759 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
table_create DocumentsArray TABLE_NO_KEY
|
2
|
+
column_create DocumentsArray title COLUMN_SCALAR ShortText
|
3
|
+
|
4
|
+
load --table DocumentsArray
|
5
|
+
[
|
6
|
+
{"title": "Groonga"}
|
7
|
+
]
|
8
|
+
|
9
|
+
|
10
|
+
table_create SectionsForArray TABLE_HASH_KEY ShortText
|
11
|
+
column_create SectionsForArray title COLUMN_SCALAR ShortText
|
12
|
+
column_create SectionsForArray document COLUMN_SCALAR DocumentsArray
|
13
|
+
load --table SectionsForArray
|
14
|
+
[
|
15
|
+
{"_key": "1.1", "title": "Groonga overview", "document": 1},
|
16
|
+
{"_key": "1.2", "title": "Full text search and Instant update", "document": 1},
|
17
|
+
{"_key": "1.3", "title": "Column store and aggregate query", "document": 1}
|
18
|
+
]
|
@@ -0,0 +1,40 @@
|
|
1
|
+
{
|
2
|
+
"effective_date": "2013-09-01T00:00:00Z",
|
3
|
+
"zones": ["localhost:23003/test"],
|
4
|
+
"farms": {
|
5
|
+
"localhost:23003/test": {
|
6
|
+
"device": ".",
|
7
|
+
"capacity": 10
|
8
|
+
}
|
9
|
+
},
|
10
|
+
"datasets": {
|
11
|
+
"Test": {
|
12
|
+
"workers": 0,
|
13
|
+
"plugins": ["for_dataset"],
|
14
|
+
"number_of_replicas": 2,
|
15
|
+
"number_of_partitions": 2,
|
16
|
+
"partition_key": "_key",
|
17
|
+
"date_range": "infinity",
|
18
|
+
"ring": {
|
19
|
+
"localhost:23041": {
|
20
|
+
"weight": 50,
|
21
|
+
"partitions": {
|
22
|
+
"2013-09-01": [
|
23
|
+
"localhost:23003/test.000",
|
24
|
+
"localhost:23003/test.001"
|
25
|
+
]
|
26
|
+
}
|
27
|
+
},
|
28
|
+
"localhost:23042": {
|
29
|
+
"weight": 50,
|
30
|
+
"partitions": {
|
31
|
+
"2013-09-01": [
|
32
|
+
"localhost:23003/test.002",
|
33
|
+
"localhost:23003/test.003"
|
34
|
+
]
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
{
|
2
|
+
"version": 2,
|
3
|
+
"effectiveDate": "2014-02-28T00:00:00Z",
|
4
|
+
"datasets": {
|
5
|
+
"Test": {
|
6
|
+
"nWorkers": 4,
|
7
|
+
"plugins": [
|
8
|
+
"plugin1",
|
9
|
+
"plugin2",
|
10
|
+
"plugin3"
|
11
|
+
],
|
12
|
+
"replicas": [
|
13
|
+
{
|
14
|
+
"dimension": "_key",
|
15
|
+
"slicer": "hash",
|
16
|
+
"slices": [
|
17
|
+
{
|
18
|
+
"label": "slice00",
|
19
|
+
"volume": {
|
20
|
+
"address": "localhost:23003/test.000"
|
21
|
+
}
|
22
|
+
},
|
23
|
+
{
|
24
|
+
"label": "slice01",
|
25
|
+
"volume": {
|
26
|
+
"address": "localhost:23003/test.001"
|
27
|
+
}
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"label": "slice02",
|
31
|
+
"volume": {
|
32
|
+
"address": "localhost:23003/test.002"
|
33
|
+
}
|
34
|
+
}
|
35
|
+
]
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"slices": [
|
39
|
+
{
|
40
|
+
"label": "slice10",
|
41
|
+
"volume": {
|
42
|
+
"address": "localhost:23004/test.010"
|
43
|
+
}
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"label": "slice11",
|
47
|
+
"volume": {
|
48
|
+
"address": "localhost:23004/test.011"
|
49
|
+
}
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"label": "slice12",
|
53
|
+
"volume": {
|
54
|
+
"address": "localhost:23004/test.012"
|
55
|
+
}
|
56
|
+
}
|
57
|
+
]
|
58
|
+
}
|
59
|
+
]
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
table_create Bigram TABLE_PAT_KEY ShortText \
|
2
|
+
--default_tokenizer TokenBigram \
|
3
|
+
--normalizer NormalizerAuto
|
4
|
+
|
5
|
+
|
6
|
+
table_create Documents TABLE_HASH_KEY ShortText
|
7
|
+
column_create Documents title COLUMN_SCALAR ShortText
|
8
|
+
column_create Bigram Documents_title COLUMN_INDEX|WITH_POSITION Documents title
|
9
|
+
|
10
|
+
load --table Documents
|
11
|
+
[
|
12
|
+
{"_key": "Groonga", "title": "Groonga"}
|
13
|
+
]
|
14
|
+
|
15
|
+
|
16
|
+
table_create Sections TABLE_HASH_KEY ShortText
|
17
|
+
column_create Sections title COLUMN_SCALAR ShortText
|
18
|
+
column_create Sections content COLUMN_SCALAR Text
|
19
|
+
column_create Sections document COLUMN_SCALAR Documents
|
20
|
+
column_create Bigram Sections_title COLUMN_INDEX|WITH_POSITION Sections title
|
21
|
+
column_create Bigram Sections_content COLUMN_INDEX|WITH_POSITION Sections content
|
22
|
+
|
23
|
+
load --table Sections
|
24
|
+
[
|
25
|
+
{"_key": "1.1", "title": "Groonga overview", "content": "Groonga is a fast and accurate full text search engine based on inverted index. One of the characteristics of groonga is that a newly registered document instantly appears in search results. Also, groonga allows updates without read locks. These characteristics result in superior performance on real-time applications.", "document": "Groonga"},
|
26
|
+
{"_key": "1.2", "title": "Full text search and Instant update", "content": "In widely used DBMSs, updates are immediately processed, for example, a newly registered record appears in the result of the next query. In contrast, some full text search engines do not support instant updates, because it is difficult to dynamically update inverted indexes, the underlying data structure.", "document": "Groonga"},
|
27
|
+
{"_key": "1.3", "title": "Column store and aggregate query", "content": "People can collect more than enough data in the Internet era. However, it is difficult to extract informative knowledge from a large database, and such a task requires a many-sided analysis through trial and error. For example, search refinement by date, time and location may reveal hidden patterns. Aggregate queries are useful to perform this kind of tasks.", "document": "Groonga"},
|
28
|
+
{"_key": "1.4", "title": "Inverted index and tokenizer", "content": "An inverted index is a traditional data structure used for large-scale full text search. A search engine based on inverted index extracts index terms from a document when it is added. Then in retrieval, a query is divided into index terms to find documents containing those index terms. In this way, index terms play an important role in full text search and thus the way of extracting index terms is a key to a better search engine.", "document": "Groonga"},
|
29
|
+
{"_key": "1.5", "title": "Sharable storage and read lock-free", "content": "Multi-core processors are mainstream today and the number of cores per processor is increasing. In order to exploit multiple cores, executing multiple queries in parallel or dividing a query into sub-queries for parallel processing is becoming more important.", "document": "Groonga"},
|
30
|
+
{"_key": "1.6", "title": "Geo-location (latitude and longitude) search", "content": "Location services are getting more convenient because of mobile devices with GPS. For example, if you are going to have lunch or dinner at a nearby restaurant, a local search service for restaurants may be very useful, and for such services, fast geo-location search is becoming more important.", "document": "Groonga"},
|
31
|
+
{"_key": "1.7", "title": "Groonga library", "content": "The basic functions of groonga are provided in a C library and any application can use groonga as a full text search engine or a column-oriented database. Also, libraries for languages other than C/C++, such as Ruby, are provided in related projects. See related projects for details.", "document": "Groonga"},
|
32
|
+
{"_key": "1.8", "title": "Groonga server", "content": "Groonga provides a built-in server command which supports HTTP, the memcached binary protocol and the groonga query transfer protocol (gqtp). Also, a groonga server supports query caching, which significantly reduces response time for repeated read queries. Using this command, groonga is available even on a server that does not allow you to install new libraries.", "document": "Groonga"},
|
33
|
+
{"_key": "1.9", "title": "Groonga storage engine", "content": "Groonga works not only as an independent column-oriented DBMS but also as storage engines of well-known DBMSs. For example, mroonga is a MySQL pluggable storage engine using groonga. By using mroonga, you can use groonga for column-oriented storage and full text search. A combination of a built-in storage engine, MyISAM or InnoDB, and a groonga-based full text search engine is also available. All the combinations have good and bad points and the best one depends on the application. See related projects for details.", "document": "Groonga"}
|
34
|
+
]
|
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
table_create SectionsForHash TABLE_HASH_KEY ShortText
|
4
|
+
column_create SectionsForHash title COLUMN_SCALAR ShortText
|
5
|
+
column_create SectionsForHash document COLUMN_SCALAR DocumentsHash
|
6
|
+
load --table SectionsForHash
|
7
|
+
[
|
8
|
+
{"_key": "1.1", "title": "Groonga overview", "document": "Groonga"},
|
9
|
+
{"_key": "1.2", "title": "Full text search and Instant update", "document": "Groonga"},
|
10
|
+
{"_key": "1.3", "title": "Column store and aggregate query", "document": "Groonga"}
|
11
|
+
]
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# Copyright (C) 2014 Droonga Project
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
require "droonga/plugins/search/distributed_search_planner"
|
17
|
+
|
18
|
+
module DistributedSearchPlannerHelper
|
19
|
+
def plan(search_request)
|
20
|
+
planner = Droonga::Plugins::Search::DistributedSearchPlanner.new(search_request)
|
21
|
+
planner.plan
|
22
|
+
end
|
23
|
+
|
24
|
+
def messages
|
25
|
+
@messages ||= plan(@request)
|
26
|
+
end
|
27
|
+
|
28
|
+
def broadcast_message
|
29
|
+
messages.find do |message|
|
30
|
+
message["type"] == "broadcast"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def reduce_message
|
35
|
+
messages.find do |message|
|
36
|
+
message["type"] == "search_reduce"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def gather_message
|
41
|
+
messages.find do |message|
|
42
|
+
message["type"] == "search_gather"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def dependencies
|
47
|
+
dependencies = messages.collect do |message|
|
48
|
+
{
|
49
|
+
"type" => message["type"],
|
50
|
+
"inputs" => message["inputs"],
|
51
|
+
"outputs" => message["outputs"],
|
52
|
+
}
|
53
|
+
end
|
54
|
+
sort_dependencies(dependencies)
|
55
|
+
end
|
56
|
+
|
57
|
+
def sort_dependencies(dependencies)
|
58
|
+
dependencies.sort do |a, b|
|
59
|
+
a["type"] <=> b["type"]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def expected_dependencies(reduce_inputs, gather_inputs)
|
64
|
+
dependencies = [
|
65
|
+
{
|
66
|
+
"type" => "search_reduce",
|
67
|
+
"inputs" => reduce_inputs,
|
68
|
+
"outputs" => gather_inputs,
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"type" => "search_gather",
|
72
|
+
"inputs" => gather_inputs,
|
73
|
+
"outputs" => nil,
|
74
|
+
},
|
75
|
+
{
|
76
|
+
"type" => "broadcast",
|
77
|
+
"inputs" => nil,
|
78
|
+
"outputs" => reduce_inputs,
|
79
|
+
},
|
80
|
+
]
|
81
|
+
sort_dependencies(dependencies)
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright (C) 2013 Droonga Project
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
module Fixture
|
17
|
+
def fixture_directory
|
18
|
+
File.join(File.dirname(__FILE__), "..", "fixtures")
|
19
|
+
end
|
20
|
+
|
21
|
+
def fixture_path(*path_components)
|
22
|
+
File.join(fixture_directory, *path_components)
|
23
|
+
end
|
24
|
+
|
25
|
+
def fixture_data(*path_components)
|
26
|
+
File.read(fixture_path(*path_components))
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# Copyright (C) 2013 Droonga Project
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
module PluginHelper
|
17
|
+
def setup_plugin(plugin_class)
|
18
|
+
@worker = StubWorker.new
|
19
|
+
@plugin = plugin_class.new(@worker)
|
20
|
+
|
21
|
+
@messages = []
|
22
|
+
stub(@plugin).emit do |*message|
|
23
|
+
@messages << message
|
24
|
+
end
|
25
|
+
|
26
|
+
@posted = []
|
27
|
+
stub(@plugin).post do |*message|
|
28
|
+
@posted << message
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def teardown_plugin
|
33
|
+
@plugin = nil
|
34
|
+
@worker = nil
|
35
|
+
@messages = nil
|
36
|
+
@posted = nil
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# Copyright (C) 2013 Droonga Project
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
module Sandbox
|
17
|
+
class << self
|
18
|
+
def included(base)
|
19
|
+
base.setup :setup_sandbox, :before => :prepend
|
20
|
+
base.teardown :teardown_sandbox, :after => :append
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def setup_sandbox
|
25
|
+
setup_temporary_directory
|
26
|
+
|
27
|
+
setup_context
|
28
|
+
|
29
|
+
@database_path = @temporary_directory + "database"
|
30
|
+
@database = nil
|
31
|
+
end
|
32
|
+
|
33
|
+
def setup_temporary_directory
|
34
|
+
@base_temporary_directory = Pathname(File.dirname(__FILE__)) + "tmp"
|
35
|
+
memory_file_system = "/run/shm"
|
36
|
+
if File.exist?(memory_file_system)
|
37
|
+
FileUtils.mkdir_p(@base_temporary_directory.parent.to_s)
|
38
|
+
FileUtils.rm_f(@base_temporary_directory.to_s)
|
39
|
+
FileUtils.ln_s(memory_file_system, @base_temporary_directory.to_s)
|
40
|
+
else
|
41
|
+
FileUtils.mkdir_p(@base_temporary_directory.to_s)
|
42
|
+
end
|
43
|
+
|
44
|
+
@temporary_directory = @base_temporary_directory + "fluent-plugin-droonga"
|
45
|
+
FileUtils.rm_rf(@temporary_directory.to_s)
|
46
|
+
FileUtils.mkdir_p(@temporary_directory.to_s)
|
47
|
+
end
|
48
|
+
|
49
|
+
def setup_context
|
50
|
+
Groonga::Context.default = nil
|
51
|
+
Groonga::Context.default_options = nil
|
52
|
+
end
|
53
|
+
|
54
|
+
def setup_database
|
55
|
+
@database = Groonga::Database.create(:path => @database_path.to_s)
|
56
|
+
end
|
57
|
+
|
58
|
+
def teardown_database
|
59
|
+
@database.close
|
60
|
+
@database = nil
|
61
|
+
end
|
62
|
+
|
63
|
+
def restore(dumped_command)
|
64
|
+
if @database
|
65
|
+
Groonga::Context.default.restore(dumped_command)
|
66
|
+
else
|
67
|
+
context = Groonga::Context.new
|
68
|
+
database = context.create_database(@database_path.to_s)
|
69
|
+
context.restore(dumped_command)
|
70
|
+
database.close
|
71
|
+
context.close
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def teardown_sandbox
|
76
|
+
Groonga::Context.default.close
|
77
|
+
Groonga::Context.default = nil
|
78
|
+
GC.start
|
79
|
+
teardown_temporary_directory
|
80
|
+
end
|
81
|
+
|
82
|
+
def teardown_temporary_directory
|
83
|
+
FileUtils.rm_rf(@temporary_directory.to_s)
|
84
|
+
FileUtils.rm_rf(@base_temporary_directory.to_s)
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Copyright (C) 2013 Droonga Project
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
class StubWorker
|
17
|
+
attr_reader :context, :body, :envelope
|
18
|
+
|
19
|
+
def initialize()
|
20
|
+
@context = Groonga::Context.default
|
21
|
+
@envelope = {}
|
22
|
+
end
|
23
|
+
|
24
|
+
def post(body, destination=nil)
|
25
|
+
@body = body
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Copyright (C) 2013 Droonga Project
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
require "droonga/watch_schema"
|
17
|
+
|
18
|
+
module WatchHelper
|
19
|
+
def setup_schema
|
20
|
+
schema = Droonga::WatchSchema.new(Groonga::Context.default)
|
21
|
+
schema.ensure_created
|
22
|
+
end
|
23
|
+
end
|
data/test/unit/helper.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# Copyright (C) 2013-2014 Droonga Project
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License version 2.1 as published by the Free Software Foundation.
|
6
|
+
#
|
7
|
+
# This library is distributed in the hope that it will be useful,
|
8
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
9
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
10
|
+
# Lesser General Public License for more details.
|
11
|
+
#
|
12
|
+
# You should have received a copy of the GNU Lesser General Public
|
13
|
+
# License along with this library; if not, write to the Free Software
|
14
|
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
15
|
+
|
16
|
+
require "droonga/test"
|
17
|
+
|
18
|
+
require_relative "helper/sandbox"
|
19
|
+
require_relative "helper/fixture"
|
20
|
+
require_relative "helper/stub_worker"
|
21
|
+
require_relative "helper/plugin_helper"
|
22
|
+
require_relative "helper/watch_helper"
|
23
|
+
require_relative "helper/distributed_search_planner_helper"
|
24
|
+
|
25
|
+
class Test::Unit::TestCase
|
26
|
+
include Sandbox
|
27
|
+
include Fixture
|
28
|
+
end
|