YUKI Hiroshi
null+****@clear*****
Wed Dec 25 14:39:29 JST 2013
YUKI Hiroshi 2013-12-25 14:39:29 +0900 (Wed, 25 Dec 2013) New Revision: d874e9412bd084e8b4faf76d9300f86aaf77abb3 https://github.com/droonga/droonga.org/commit/d874e9412bd084e8b4faf76d9300f86aaf77abb3 Message: Translate tutorial based on .po file Modified files: _po/ja/tutorial/index.po ja/tutorial/index.md Modified: _po/ja/tutorial/index.po (+1012 -1) =================================================================== --- _po/ja/tutorial/index.po 2013-12-25 13:39:29 +0900 (a793b98) +++ _po/ja/tutorial/index.po 2013-12-25 14:39:29 +0900 (2082f46) @@ -23,6 +23,1017 @@ msgid "" "layout: documents\n" "---" msgstr "" +"---\n" +"title: Droonga チュートリアル\n" +"layout: documents_ja\n" +"---" + +msgid "" +"* TOC\n" +"{:toc}" +msgstr "" + +msgid "## The goal of this tutorial" +msgstr "## チュートリアルのゴール" + +msgid "Learning steps to setup a Droonga based search system by yourself." +msgstr "Droonga を使った検索システムを自分で構築できるようになる。" + +msgid "## Precondition" +msgstr "## 前提条件" + +msgid "" +"* You must have basic knowledges and experiences how setup and operate an [Ubu" +"ntu][] Server.\n" +"* You must have basic knowledges and experiences to develop applications based" +" on the [Ruby][] and the [Node.js][]." +msgstr "" +"* [Ubuntu][] Server を自分でセットアップしたり、基本的な操作ができること\n" +"* [Ruby][] と [Node.js][] の基本的な知識があること" + +msgid "## Abstract" +msgstr "## 概要" + +msgid "### What is the Droonga?" +msgstr "### Droonga とは" + +msgid "" +"It is a data processing engine based on a distributed architecture, named afte" +"r the terms \"distributed-Groonga\"." +msgstr "分散データ処理エンジンです。 \"distributed-groonga\" に由来します。" + +msgid "" +"The Droonga is built on some components which are made as separated packages. " +"You can develop various data processing systems (for example, a fulltext searc" +"h engine) with high scalability from a distributed architecture, with those pa" +"ckages." +msgstr "" +"Droonga は複数のコンポーネントから構成されています。ユーザは、これらのパッケージを組み合わせて利用することで、全文検索をはじめとするスケーラブルな分" +"散データ処理システムを構築することができます。" + +msgid "### Components of the Droonga" +msgstr "### Droonga を構成するコンポーネント" + +msgid "#### Droonga Engine" +msgstr "" + +msgid "" +"The component \"Droonga Engine\" is the main part to process data with a distrib" +"uted architecture. It is triggered by requests and processes various data." +msgstr "Droonga Engine は Droonga における分散データ処理の要となるコンポーネントです。リクエストに基いて実際のデータ処理を行います。" + +msgid "" +"This component is developed as a [Fluentd] plugin, and released as the [fluent" +"-plugin-droonga][] package.\n" +"It internally uses [Groonga][] as its search engine. Groonga is an open source" +", fulltext search engine, including a column-store feature." +msgstr "" +"このコンポーネントは [Fluentd] のプラグインとして実装されており、 [fluent-plugin-droonga][] パッケージとして提供されま" +"す。\n" +"[fluent-plugin-droonga][] は検索エンジンとして、オープンソースのカラムストア機能付き全文検索エンジン [Groonga][] を使" +"用しています。" + +msgid "#### Protocol Adapter" +msgstr "" + +msgid "" +"The component \"Protocol Adapter\" provides ability for clients to communicate w" +"ith a Droonga engine, using various protocols." +msgstr "Protocol Adapter は、Droonga を様々なプロトコルで利用できるようにするためのアダプタです。" + +msgid "" +"This component is developed as a module for the [Node.js][], and released as t" +"he [express-droonga][] package." +msgstr "このコンポーネントは [Node.js][] のパッケージとして実装されており、[express-droonga][] パッケージとして提供されます。" + +msgid "" +"The only one available protocol of a Droonga engine is the fluentd protocol. I" +"nstead, a protocol adapter provides various interfaces, HTTP, Socket.IO, and s" +"o on, for applications, between them and a Droonga engine." +msgstr "" +"Droonga Engine は fluentd プロトコルで通信を行います。Protocol Adapter は、ユーザがアプリケーションを構築する際に利" +"用しやすいよう、 Droonga Engine の機能を HTTP や Socket.IO などのインタフェースで提供します。" + +msgid "## Abstract of the system described in this tutorial" +msgstr "## チュートリアルでつくるシステムの全体像" + +msgid "This tutorial describes steps to build a system like following:" +msgstr "チュートリアルでは、以下の様な構成のシステムを構築します。" + +msgid "" +" +-------------+ +------------------+ +-----------" +"-----+\n" +" | Web Browser | <--------> | Protocol Adapter | <-------> | Droonga En" +"gine |\n" +" +-------------+ HTTP / +------------------+ Fluent +-----------" +"-----+\n" +" Socket.IO w/express-droonga protocol w/fluent-pl" +"ugin\n" +" -dr" +"oonga" +msgstr "" + +msgid "" +" \\--------------------------------------------" +"------/\n" +" This tutorial describes about this part" +"." +msgstr "" +" \\--------------------------------------------" +"------/\n" +" この部分を構築します" + +msgid "" +"User agents (ex. a Web browser) sends search requests to a protocol adapter. T" +"he adapter receives them, and sends internal (translated) search requests to a" +" Droonga engine. The engine processes them actually. Search results are sent f" +"rom the engine to the protocol adapter, and finally delivered to the user agen" +"t." +msgstr "" +"ユーザは Protocol Adapter に、Web ブラウザなどを用いて接続します。Protocol Adapter は Droonga Engine " +"へリクエストを送信します。実際の検索処理は Droonga Engine が行います。検索結果は、Droonga Engine から Protocol Ad" +"apter に渡され、最終的にユーザに返ります。" + +msgid "" +"For example let's try to build a database system to find [Starbucks stores in " +"New York](http://geocommons.com/overlays/430038)." +msgstr "" +"例として、[ニューヨークにあるのスターバックスの店舗](http://geocommons.com/overlays/430038)を検索できるデータベース" +"システムを作成することにします。" + +msgid "## Prepare an environment for experiments" +msgstr "## 実験用のマシンを用意する" + +msgid "" +"Prepare a computer at first. This tutorial describes steps to develop a search" +" service based on the Droonga, on an existing computer.\n" +"Following instructions are basically written for a successfully prepared virtu" +"al machine of the `Ubuntu 13.10 x64` on the service [DigitalOcean](https://www" +".digitalocean.com/), with an available console." +msgstr "" +"まずコンピュータを調達しましょう。このチュートリアルでは、既存のコンピュータにDroongaによる検索システムを構築する手順を解説します。\n" +"以降の説明は基本的に、[DigitalOcean](https://www.digitalocean.com/)で `Ubuntu 13.10 x64` の" +"仮想マシンのセットアップを完了し、コンソールにアクセスできる状態になった後を前提として進めます。" + +msgid "" +"NOTE: Make sure to use instances with >= 2GB memory equipped, at least during " +"installation of required packages for Droonga. Otherwise, you may experience a" +" strange build error." +msgstr "" +"注意:Droongaが必要とするパッケージをインストールする前に、マシンが2GB以上のメモリを備えていることを確認して下さい。メモリが不足していると、ビルド" +"時にエラーが出て、ビルドに失敗することがあります。" + +msgid "## Install packages required for the setup process" +msgstr "## セットアップに必要なパッケージをインストールする" + +msgid "Install packages required to setup a Droonga engine." +msgstr "Droonga をセットアップするために必要になるパッケージをインストールします。" + +msgid "" +" # apt-get update\n" +" # apt-get -y upgrade\n" +" # apt-get install -y ruby ruby-dev build-essential nodejs npm" +msgstr "" + +msgid "## Build a Droonga engine" +msgstr "## Droonga Engine を構築する" + +msgid "" +"The part \"Droonga engine\" stores the database and provides the search feature " +"actually.\n" +"In this section we install a fluent-plugin-droonga and load searchable data to" +" the database." +msgstr "" +"Droonga Engine は、データベースを保持し、実際の検索を担当する部分です。\n" +"このセクションでは、 fluent-plugin-droonga をインストールし、検索対象となるデータを準備します。" + +msgid "### Install a fluent-plugin-droonga" +msgstr "### fluent-plugin-droonga をインストールする" + +msgid " # gem install fluent-plugin-droonga" +msgstr "" + +msgid "" +"Required packages are prepared by the command above. Let's continue to the con" +"figuration step." +msgstr "Droonga Engine を構築するのに必要なパッケージがセットアップできました。引き続き設定に移ります。" + +msgid "### Prepare a configuration file to start a Droonga engine" +msgstr "### Droonga Engine を起動するための設定ファイルを用意する" + +msgid "Create a directory for a Droonga engine:" +msgstr "まず Droonga Engine 用のディレクトリを作成します。" + +msgid "" +" # mkdir engine\n" +" # cd engine" +msgstr "" + +msgid "" +"Next, put configuration files `fluentd.conf` and `catalog.json` like following" +", into the directory:" +msgstr "以下の内容で `fluentd.conf` と `catalog.json` を作成します。" + +msgid "fluentd.conf:" +msgstr "" + +msgid "" +" <source>\n" +" type forward\n" +" port 24224\n" +" </source>\n" +" <match starbucks.message>\n" +" name localhost:24224/starbucks\n" +" type droonga\n" +" </match>\n" +" <match output.message>\n" +" type stdout\n" +" </match>" +msgstr "" + +msgid "catalog.json:" +msgstr "" + +msgid "" +" {\n" +" \"effective_date\": \"2013-09-01T00:00:00Z\",\n" +" \"zones\": [\"localhost:24224/starbucks\"],\n" +" \"farms\": {\n" +" \"localhost:24224/starbucks\": {\n" +" \"device\": \".\",\n" +" \"capacity\": 10\n" +" }\n" +" },\n" +" \"datasets\": {\n" +" \"Starbucks\": {\n" +" \"workers\": 0,\n" +" \"plugins\": [\"search\", \"groonga\", \"add\"],\n" +" \"number_of_replicas\": 2,\n" +" \"number_of_partitions\": 2,\n" +" \"partition_key\": \"_key\",\n" +" \"date_range\": \"infinity\",\n" +" \"ring\": {\n" +" \"localhost:23041\": {\n" +" \"weight\": 50,\n" +" \"partitions\": {\n" +" \"2013-09-01\": [\n" +" \"localhost:24224/starbucks.000\",\n" +" \"localhost:24224/starbucks.001\"\n" +" ]\n" +" }\n" +" },\n" +" \"localhost:23042\": {\n" +" \"weight\": 50,\n" +" \"partitions\": {\n" +" \"2013-09-01\": [\n" +" \"localhost:24224/starbucks.002\",\n" +" \"localhost:24224/starbucks.003\"\n" +" ]\n" +" }\n" +" }\n" +" }\n" +" }\n" +" },\n" +" \"options\": {\n" +" \"plugins\": [\"select\"]\n" +" }\n" +" }" +msgstr "" + +msgid "" +"This `catalog.json` defines a dataset `Starbucks` with two replicas and two pa" +"rtitions.\n" +"All of replicas and partitions are stored locally (in other words, they are ma" +"naged by a `fluent-plugin-droonga` instance)." +msgstr "" +"この `catalog.json` では、 `Starbucks` データセットを定義し、2組のレプリカ×2個のパーティションで構成するよう指示しています。" +"\n" +"この例では、全てのレプリカ及びパーティションは、ローカル(一つの `fluent-plugin-droonga` の管理下)に配置します。" + +msgid "" +"For more details of the configuration file `catalog.json`, see [the reference " +"manual of catalog.json](/reference/catalog)." +msgstr "`catalog.json` の詳細については [catalog.json](/ja/reference/catalog) を参照してください。" + +msgid "### Start an instance of fluent-plugin-droonga" +msgstr "### fluent-plugin-droonga を起動する" + +msgid "" +"Start a Droonga engine, it is a fluentd server with fluentd-plugin-droonga sta" +"rted like:" +msgstr "以下のようにして fluentd-plugin-droonga を起動します。" + +msgid "" +" # fluentd --config fluentd.conf\n" +" 2013-11-12 14:14:20 +0900 [info]: starting fluentd-0.10.40\n" +" 2013-11-12 14:14:20 +0900 [info]: reading config file path=\"fluentd.conf\"\n" +" 2013-11-12 14:14:20 +0900 [info]: gem 'fluent-plugin-droonga' version '0.0" +".1'\n" +" 2013-11-12 14:14:20 +0900 [info]: gem 'fluentd' version '0.10.40'\n" +" 2013-11-12 14:14:20 +0900 [info]: using configuration file: <ROOT>\n" +" <source>\n" +" type forward\n" +" port 24224\n" +" </source>\n" +" <match starbucks.message>\n" +" name localhost:24224/starbucks\n" +" type droonga\n" +" </match>\n" +" <match output.message>\n" +" type stdout\n" +" </match>\n" +" </ROOT>\n" +" 2013-11-12 14:14:20 +0900 [info]: adding source type=\"forward\"\n" +" 2013-11-12 14:14:20 +0900 [info]: adding match pattern=\"starbucks.message\"" +" type=\"droonga\"\n" +" 2013-11-12 14:14:20 +0900 [info]: adding match pattern=\"output.message\" ty" +"pe=\"stdout\"\n" +" 2013-11-12 14:14:20 +0900 [info]: listening fluent socket on 0.0.0.0:24224" +msgstr "" + +msgid "### Create a database" +msgstr "### データベースを作成する" + +msgid "" +"After a Droonga engine is started, let's load data.\n" +"Prepare two jsons files, `ddl.jsons` including the database schema and `stores" +".jsons` including location data of stores." +msgstr "" +"Dronga Engine が起動したので、データを投入しましょう。\n" +"スキーマを定義した `ddl.jsons` と、店舗のデータ `stores.jsons` を用意します。" + +msgid "ddl.jsons:" +msgstr "" + +msgid "" +" {\"id\":\"ddl:0\",\"dataset\":\"Starbucks\",\"type\":\"table_create\",\"replyTo\":\"local" +"host:24224/output\",\"body\":{\"name\":\"Store\",\"flags\":\"TABLE_HASH_KEY\",\"key_type\":" +"\"ShortText\"}}\n" +" {\"id\":\"ddl:1\",\"dataset\":\"Starbucks\",\"type\":\"column_create\",\"replyTo\":\"loca" +"lhost:24224/output\",\"body\":{\"table\":\"Store\",\"name\":\"location\",\"flags\":\"COLUMN_" +"SCALAR\",\"type\":\"WGS84GeoPoint\"}}\n" +" {\"id\":\"ddl:2\",\"dataset\":\"Starbucks\",\"type\":\"table_create\",\"replyTo\":\"local" +"host:24224/output\",\"body\":{\"name\":\"Location\",\"flags\":\"TABLE_PAT_KEY\",\"key_type" +"\":\"WGS84GeoPoint\"}}\n" +" {\"id\":\"ddl:3\",\"dataset\":\"Starbucks\",\"type\":\"column_create\",\"replyTo\":\"loca" +"lhost:24224/output\",\"body\":{\"table\":\"Location\",\"name\":\"store\",\"flags\":\"COLUMN_" +"INDEX\",\"type\":\"Store\",\"source\":\"location\"}}\n" +" {\"id\":\"ddl:4\",\"dataset\":\"Starbucks\",\"type\":\"table_create\",\"replyTo\":\"local" +"host:24224/output\",\"body\":{\"name\":\"Term\",\"flags\":\"TABLE_PAT_KEY\",\"key_type\":\"S" +"hortText\",\"default_tokenizer\":\"TokenBigram\",\"normalizer\":\"NormalizerAuto\"}}\n" +" {\"id\":\"ddl:5\",\"dataset\":\"Starbucks\",\"type\":\"column_create\",\"replyTo\":\"loca" +"lhost:24224/output\",\"body\":{\"table\":\"Term\",\"name\":\"stores__key\",\"flags\":\"COLUM" +"N_INDEX|WITH_POSITION\",\"type\":\"Store\",\"source\":\"_key\"}}" +msgstr "" + +msgid "stores.jsons:" +msgstr "" + +msgid "" +" {\"id\":\"stores:0\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"," +"\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"1st Avenue & 75th St. - New York N" +"Y (W)\",\"values\":{\"location\":\"40.770262,-73.954798\"}}}\n" +" {\"id\":\"stores:1\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"," +"\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"76th & Second - New York NY (W)\"," +"\"values\":{\"location\":\"40.771056,-73.956757\"}}}\n" +" {\"id\":\"stores:2\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"," +"\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"2nd Ave. & 9th Street - New York N" +"Y\",\"values\":{\"location\":\"40.729445,-73.987471\"}}}\n" +" {\"id\":\"stores:3\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"," +"\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"15th & Third - New York NY (W)\",\"" +"values\":{\"location\":\"40.733946,-73.9867\"}}}\n" +" {\"id\":\"stores:4\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"," +"\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"41st and Broadway - New York NY (" +"W)\",\"values\":{\"location\":\"40.755111,-73.986225\"}}}\n" +" {\"id\":\"stores:5\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"," +"\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"84th & Third Ave - New York NY (W" +")\",\"values\":{\"location\":\"40.777485,-73.954979\"}}}\n" +" {\"id\":\"stores:6\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"," +"\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"150 E. 42nd Street - New York NY " +"(W)\",\"values\":{\"location\":\"40.750784,-73.975582\"}}}\n" +" {\"id\":\"stores:7\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"," +"\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"West 43rd and Broadway - New York " +"NY (W)\",\"values\":{\"location\":\"40.756197,-73.985624\"}}}\n" +" {\"id\":\"stores:8\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"," +"\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"Macy's 35th Street Balcony - New Y" +"ork NY\",\"values\":{\"location\":\"40.750703,-73.989787\"}}}\n" +" {\"id\":\"stores:9\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"," +"\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"Macy's 6th Floor - Herald Square -" +" New York NY (W)\",\"values\":{\"location\":\"40.750703,-73.989787\"}}}\n" +" {\"id\":\"stores:10\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"Herald Square- Macy's - New York " +"NY\",\"values\":{\"location\":\"40.750703,-73.989787\"}}}\n" +" {\"id\":\"stores:11\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"Macy's 5th Floor - Herald Square " +"- New York NY (W)\",\"values\":{\"location\":\"40.750703,-73.989787\"}}}\n" +" {\"id\":\"stores:12\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"80th & York - New York NY (W)\",\"" +"values\":{\"location\":\"40.772204,-73.949862\"}}}\n" +" {\"id\":\"stores:13\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"Columbus @ 67th - New York NY (W" +")\",\"values\":{\"location\":\"40.774009,-73.981472\"}}}\n" +" {\"id\":\"stores:14\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"45th & Broadway - New York NY (W" +")\",\"values\":{\"location\":\"40.75766,-73.985719\"}}}\n" +" {\"id\":\"stores:15\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"Marriott Marquis - Lobby - New Yo" +"rk NY\",\"values\":{\"location\":\"40.759123,-73.984927\"}}}\n" +" {\"id\":\"stores:16\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"Second @ 81st - New York NY (W)\"" +",\"values\":{\"location\":\"40.77466,-73.954447\"}}}\n" +" {\"id\":\"stores:17\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"52nd & Seventh - New York NY (W)" +"\",\"values\":{\"location\":\"40.761829,-73.981141\"}}}\n" +" {\"id\":\"stores:18\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"1585 Broadway (47th) - New York N" +"Y (W)\",\"values\":{\"location\":\"40.759806,-73.985066\"}}}\n" +" {\"id\":\"stores:19\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"85th & First - New York NY (W)\"," +"\"values\":{\"location\":\"40.776101,-73.949971\"}}}\n" +" {\"id\":\"stores:20\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"92nd & 3rd - New York NY (W)\",\"v" +"alues\":{\"location\":\"40.782606,-73.951235\"}}}\n" +" {\"id\":\"stores:21\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"165 Broadway - 1 Liberty - New Yo" +"rk NY (W)\",\"values\":{\"location\":\"40.709727,-74.011395\"}}}\n" +" {\"id\":\"stores:22\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"1656 Broadway - New York NY (W)\"" +",\"values\":{\"location\":\"40.762434,-73.983364\"}}}\n" +" {\"id\":\"stores:23\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"54th & Broadway - New York NY (W" +")\",\"values\":{\"location\":\"40.764275,-73.982361\"}}}\n" +" {\"id\":\"stores:24\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"Limited Brands-NYC - New York NY\"" +",\"values\":{\"location\":\"40.765219,-73.982025\"}}}\n" +" {\"id\":\"stores:25\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"19th & 8th - New York NY (W)\",\"v" +"alues\":{\"location\":\"40.743218,-74.000605\"}}}\n" +" {\"id\":\"stores:26\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"60th & Broadway-II - New York NY " +" (W)\",\"values\":{\"location\":\"40.769196,-73.982576\"}}}\n" +" {\"id\":\"stores:27\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"63rd & Broadway - New York NY (W" +")\",\"values\":{\"location\":\"40.771376,-73.982709\"}}}\n" +" {\"id\":\"stores:28\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"195 Broadway - New York NY (W)\"," +"\"values\":{\"location\":\"40.710703,-74.009485\"}}}\n" +" {\"id\":\"stores:29\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"2 Broadway - New York NY (W)\",\"v" +"alues\":{\"location\":\"40.704538,-74.01324\"}}}\n" +" {\"id\":\"stores:30\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"2 Columbus Ave. - New York NY (W" +")\",\"values\":{\"location\":\"40.769262,-73.984764\"}}}\n" +" {\"id\":\"stores:31\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"NY Plaza - New York NY (W)\",\"val" +"ues\":{\"location\":\"40.702802,-74.012784\"}}}\n" +" {\"id\":\"stores:32\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"36th and Madison - New York NY (" +"W)\",\"values\":{\"location\":\"40.748917,-73.982683\"}}}\n" +" {\"id\":\"stores:33\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"125th St. btwn Adam Clayton & FDB" +" - New York NY\",\"values\":{\"location\":\"40.808952,-73.948229\"}}}\n" +" {\"id\":\"stores:34\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"70th & Broadway - New York NY (W" +")\",\"values\":{\"location\":\"40.777463,-73.982237\"}}}\n" +" {\"id\":\"stores:35\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"2138 Broadway - New York NY (W)\"" +",\"values\":{\"location\":\"40.781078,-73.981167\"}}}\n" +" {\"id\":\"stores:36\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"118th & Frederick Douglas Blvd. -" +" New York NY (W)\",\"values\":{\"location\":\"40.806176,-73.954109\"}}}\n" +" {\"id\":\"stores:37\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"42nd & Second - New York NY (W)\"" +",\"values\":{\"location\":\"40.750069,-73.973393\"}}}\n" +" {\"id\":\"stores:38\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"Broadway @ 81st - New York NY (W" +")\",\"values\":{\"location\":\"40.784972,-73.978987\"}}}\n" +" {\"id\":\"stores:39\",\"replyTo\":\"localhost:24224/output\",\"dataset\":\"Starbucks\"" +",\"type\":\"add\",\"body\":{\"table\":\"Store\",\"key\":\"Fashion Inst of Technology - New " +"York NY\",\"values\":{\"location\":\"40.746948,-73.994557\"}}}" +msgstr "" -msgid "Not yet available in English. See [Japanese version](/ja/tutorial)." +msgid "" +"Open another terminal to keep the fluentd server working, and send those two j" +"sons `ddl.jsons` and `stores.jsons` to the fluentd server:" +msgstr "fluentd を起動した状態で別の端末を開き、以下のようにして `ddl.jsons` と `stores.jsons` を投入します:" + +msgid "" +" # fluent-cat starbucks.message < ddl.jsons\n" +" # fluent-cat starbucks.message < stores.jsons" +msgstr "" + +msgid "" +"Now a Droonga engine for searching Starbucks stores database is ready.\n" +"Next, setup a protocol adapter for clients to accept search requests using pop" +"ular protocols." +msgstr "" +"これで、スターバックスの店舗のデータベースを検索するための Droonga Engine ができました。\n" +"引き続き Protocol Adapter を構築して、検索リクエストを受け付けられるようにしましょう。" + +msgid "## Build a protocol adapter" +msgstr "## Protocol Adapter を構築する" + +msgid "" +"Let's use the `express-droonga` to build a protocol adapter. It is an npm pack" +"age for the Node.js." +msgstr "" +"Protocol Adapter を構築するために、 `express-droonga` を使用します。 `express-droonga` は、Node." +"js のパッケージです。" + +msgid "### Install a express-droonga" +msgstr "### express-droonga をインストールする" + +msgid "" +" # cd ~\n" +" # mkdir protocol-adapter\n" +" # cd protocol-adapter" +msgstr "" + +msgid "After that, put a file `package.json` like following, into the directory:" +msgstr "以下のような `package.json` を用意します。" + +msgid "package.json:" +msgstr "" + +msgid "" +" {\n" +" \"name\": \"protocol-adapter\",\n" +" \"description\": \"Droonga Protocol Adapter\",\n" +" \"version\": \"0.0.0\",\n" +" \"author\": \"Droonga Project\",\n" +" \"private\": true,\n" +" \"dependencies\": {\n" +" \"express\": \"*\",\n" +" \"express-droonga\": \"*\"\n" +" }\n" +" }" +msgstr "" + +msgid "Install depending packages." +msgstr "必要なパッケージをインストールします。" + +msgid " $ npm install" +msgstr "" + +msgid "### Create a protocol adapter" +msgstr "### Protocol Adapter を作成する" + +msgid "Put a file `application.js` like following, into the directory:" +msgstr "以下のような内容で `application.js` を作成します。" + +msgid "application.js:" +msgstr "" + +msgid "" +" var express = require('express'),\n" +" droonga = require('express-droonga');" +msgstr "" + +msgid "" +" var application = express();\n" +" var server = require('http').createServer(application);\n" +" server.listen(3000); // the port to communicate with clients" +msgstr "" + +msgid "" +" application.droonga({\n" +" prefix: '/droonga',\n" +" tag: 'starbucks',\n" +" defaultDataset: 'Starbucks',\n" +" server: server, // this is required to initialize Socket.IO API!\n" +" plugins: [\n" +" droonga.API_REST,\n" +" droonga.API_SOCKET_IO,\n" +" droonga.API_GROONGA,\n" +" droonga.API_DROONGA\n" +" ]\n" +" });" +msgstr "" + +msgid "Then, run the `application.js`." +msgstr "`application.js` を実行します。" + +msgid "" +" # nodejs application.js\n" +" info - socket.io started" +msgstr "" + +msgid "### Synchronous search request via HTTP" +msgstr "### HTTPでの同期的な検索のリクエスト" + +msgid "" +"We're all set. Let's send a search request to the protocol adapter via HTTP. A" +"t first, try to get all records of the `Stores` table by a request like follow" +"ing. (Note: The `attributes=_key` parameter means \"export the value of the col" +"umn `_key` to the search result\". If you don't set the parameter, each record " +"returned in the `records` will become just a blank array. You can specify mult" +"iple column names by the delimiter `,`. For example `attributes=_key,location`" +" will return both the primary key and the location for each record.)" +msgstr "" +"準備が整いました。 Protocol Adapter に向けて HTTP 経由でリクエストを発行し、データベースに問い合わせを行ってみましょう。まずは `S" +"hops` テーブルの中身を取得してみます。以下のようなリクエストを用います。(`attributes=_key` を指定しているのは「検索結果に `_ke" +"y` 値を含めて返してほしい」という意味です。これがないと、`records` に何も値がないレコードが返ってきてしまいます。`attributes` パラ" +"メータには `,` 区切りで複数の属性を指定することができます。`attributes=_key,location` と指定することで、緯度経度もレスポンス" +"として受け取ることができます)" + +msgid "" +" # curl \"http://localhost:3000/droonga/tables/Store?attributes=_key&limit=-" +"1\"\n" +" {\n" +" \"result\": {\n" +" \"count\": 40,\n" +" \"records\": [\n" +" [\n" +" \"76th & Second - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"15th & Third - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"41st and Broadway - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"West 43rd and Broadway - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"Macy's 6th Floor - Herald Square - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"Herald Square- Macy's - New York NY\"\n" +" ],\n" +" [\n" +" \"Columbus @ 67th - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"45th & Broadway - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"1585 Broadway (47th) - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"85th & First - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"92nd & 3rd - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"1656 Broadway - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"19th & 8th - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"60th & Broadway-II - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"195 Broadway - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"2 Broadway - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"NY Plaza - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"36th and Madison - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"125th St. btwn Adam Clayton & FDB - New York NY\"\n" +" ],\n" +" [\n" +" \"2138 Broadway - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"118th & Frederick Douglas Blvd. - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"42nd & Second - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"1st Avenue & 75th St. - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"2nd Ave. & 9th Street - New York NY\"\n" +" ],\n" +" [\n" +" \"84th & Third Ave - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"150 E. 42nd Street - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"Macy's 35th Street Balcony - New York NY\"\n" +" ],\n" +" [\n" +" \"Macy's 5th Floor - Herald Square - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"80th & York - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"Marriott Marquis - Lobby - New York NY\"\n" +" ],\n" +" [\n" +" \"Second @ 81st - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"52nd & Seventh - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"165 Broadway - 1 Liberty - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"54th & Broadway - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"Limited Brands-NYC - New York NY\"\n" +" ],\n" +" [\n" +" \"63rd & Broadway - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"2 Columbus Ave. - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"70th & Broadway - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"Broadway @ 81st - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"Fashion Inst of Technology - New York NY\"\n" +" ]\n" +" ]\n" +" }\n" +" }" +msgstr "" + +msgid "" +"Because the `count` says `40`, you know there are all 40 records in the table." +" Search result records are returned as an array `records`." +msgstr "`count` の値からデータが全部で 36 件あることがわかります。`records` に配列として検索結果が入っています。" + +msgid "" +"Next step, let's try more meaningful query. To search stores which contain \"Co" +"lumbus\" in their name, give `Columbus` as the parameter `query`, and give `_ke" +"y` as the parameter `match_to` which means the column to be searched. Then:" +msgstr "" +"もう少し複雑なクエリを試してみましょう。例えば、店名に「Columbus」を含む店舗を検索します。`query` パラメータにクエリ `Columbus` " +"を、`match_to` パラメータに検索対象として `_key` を指定し、以下のようなリクエストを発行します。" + +msgid "" +" # curl \"http://localhost:3000/droonga/tables/Store?query=Columbus&match_to" +"=_key&attributes=_key&limit=-1\"\n" +" {\n" +" \"result\": {\n" +" \"count\": 2,\n" +" \"records\": [\n" +" [\n" +" \"Columbus @ 67th - New York NY (W)\"\n" +" ],\n" +" [\n" +" \"2 Columbus Ave. - New York NY (W)\"\n" +" ]\n" +" ]\n" +" }\n" +" }" +msgstr "" + +msgid "As the result two stores are found by the search condition." +msgstr "以上 2 件が検索結果として該当することがわかりました。" + +msgid "### Asynchronous search request via Socket.IO" +msgstr "### Socket.IO を用いた非同期処理" + +msgid "" +"A Droonga protocol adapter supports not only REST API, but also [Socket.IO][]." +" If you send a request to a protocol adapter via Socket.IO, then the protocol " +"adapter sends back the response for the request after the operation is finishe" +"d. So you can develop a system based on a client application and an API server" +" communicating each other asynchronously." +msgstr "" +"Droonga の Protocol Adapter は、 REST API だけでなく、 [Socket.IO][] にも対応しています。Socket.I" +"O 経由で Protocol Adapter へリクエストを送ると、処理が完了した時点で Protocol Adapter から結果を送り返してもらえます。" +"この仕組を利用すると、クライアントアプリケーションと Droonga の間でリクエストとレスポンスを別々に送り合う、非同期な通信を行うことができます。" + +msgid "Now, let's create such a system based on Socket.IO." +msgstr "" +"ここでは、Webブラウザを「クライアントアプリケーション」とし、Protocol Adapter との間で Socket.IO を利用して通信するアプリケー" +"ションを作成してみましょう。" + +msgid "" +"The sample client application is a simple Web page `index.html` loaded in a We" +"b browser, returned by the protocol adapter itself.\n" +"Put a file `index.html` into the `protocol-adaptor` directory, like following:" +msgstr "" +"Protocol Adapter から `index.html` を配信し、Webブラウザに渡すことにしましょう。\n" +"`protocol-adapter` ディレクトリの下に以下の内容の `index.html` を配置します。" + +msgid "index.html:" +msgstr "" + +msgid "" +" <html>\n" +" <head>\n" +" <script src=\"/socket.io/socket.io.js\"></script>\n" +" <script>\n" +" var socket = io.connect();\n" +" socket.on('search.result', function (data) {\n" +" document.body.textContent += JSON.stringify(data);\n" +" });\n" +" socket.emit('search', { queries: {\n" +" result: {\n" +" source: 'Store',\n" +" output: {\n" +" elements: [\n" +" 'startTime',\n" +" 'elapsedTime',\n" +" 'count',\n" +" 'attributes',\n" +" 'records'\n" +" ],\n" +" attributes: ['_key'],\n" +" limit: -1\n" +" }\n" +" }\n" +" }});\n" +" </script>\n" +" </head>\n" +" <body>\n" +" </body>\n" +" </html>" +msgstr "" + +msgid "" +"This client sends a search query by `socket.emit()`. After the request is proc" +"essed and the result is returned, the callback given as `socket.on('search.res" +"ult', ...)` will be called with the result, and it will render the result to t" +"he page." +msgstr "" +"`socket.emit()` でクエリを送信します。クエリの処理が完了し、結果が戻ってくると、 `socket.on('search.result', ." +"..)` のコールバックが呼ばれ、ページ内にその結果が表示されます。" + +msgid "" +"The first argument `'search'` for the method call `socket.emit()` means that t" +"he request is a search request.\n" +"The second argument includes parameters of the search request. See the command" +" reference of the [`search` command](/reference/commands/search) for more deta" +"ils.\n" +"(By the way, we used a REST API to do search in the previous section. In the c" +"ase the protocol adapter translates a HTTP request to a message in the format " +"described in the [command reference of the `search`](/reference/commands/searc" +"h) internally and sends it to the Droonga engine.)" +msgstr "" +"`socket.emit()` の第1引数 `'search'` は、このリクエストが検索リクエストであることを指定しています。\n" +"第2引数でどのような検索を行うかを指定しています。\n" +"詳しくは [search](/ja/reference/commands/search) を参照してください。\n" +"ところで、前のセクションでは、REST API を利用して検索を行いました。\n" +"REST API を利用した場合は、 `express-droonga` が内部で REST リクエストから上記の形式のメッセージへと変換し、`fluent" +"-plugin-droonga` に送信するようになっています。" + +msgid "" +"Next, modify the `application.js` to host the `index.html` by the protocol ada" +"pter, like:" +msgstr "" +"では、この `index.html` を Protocol Adapter でホストできるようにするため、`application.js` を以下のように書" +"き換えます。" + +msgid "" +" //============== INSERTED ==============\n" +" application.get('/', function(req, res) {\n" +" res.sendfile(__dirname + '/index.html');\n" +" });\n" +" //============= /INSERTED ==============" +msgstr "" + +msgid "" +"Then, type the IP address of the server for experiments into the address bar o" +"f your Web browser. For example, if the IP address is `192.0.2.1`, then the lo" +"cation is `http://192.0.2.1:3000/` and you can see the contents of the `index." +"html`. When you see the search result like following, then the search request " +"is successfully processed:" +msgstr "" +"Web ブラウザにサーバの IP アドレスを入れて、リクエストを送信してみましょう。\n" +"以降、サーバの IP アドレスが `192.0.2.1` であったとします。\n" +"`http://192.0.2.1:3000/` をリクエストすると、先の `index.html` が返されるようになります。\n" +"Webブラウザから `http://192.0.2.1:3000` を開いてみてください。以下のように検索結果が表示されれば成功です。" + +msgid "" +" {\"result\":{\"count\":40,\"records\":[[\"76th & Second - New York NY (W)\"],[\"15t" +"h & Third - New York NY (W)\"],[\"41st and Broadway - New York NY (W)\"],[\"West 4" +"3rd and Broadway - New York NY (W)\"],[\"Macy's 6th Floor - Herald Square - New " +"York NY (W)\"],[\"Herald Square- Macy's - New York NY\"],[\"Columbus @ 67th - New " +"York NY (W)\"],[\"45th & Broadway - New York NY (W)\"],[\"1585 Broadway (47th) - N" +"ew York NY (W)\"],[\"85th & First - New York NY (W)\"],[\"92nd & 3rd - New York NY" +" (W)\"],[\"1656 Broadway - New York NY (W)\"],[\"19th & 8th - New York NY (W)\"],[\"" +"60th & Broadway-II - New York NY (W)\"],[\"195 Broadway - New York NY (W)\"],[\"2 " +"Broadway - New York NY (W)\"],[\"NY Plaza - New York NY (W)\"],[\"36th and Madison" +" - New York NY (W)\"],[\"125th St. btwn Adam Clayton & FDB - New York NY\"],[\"213" +"8 Broadway - New York NY (W)\"],[\"118th & Frederick Douglas Blvd. - New York NY" +" (W)\"],[\"42nd & Second - New York NY (W)\"],[\"1st Avenue & 75th St. - New York " +"NY (W)\"],[\"2nd Ave. & 9th Street - New York NY\"],[\"84th & Third Ave - New York" +" NY (W)\"],[\"150 E. 42nd Street - New York NY (W)\"],[\"Macy's 35th Street Balcon" +"y - New York NY\"],[\"Macy's 5th Floor - Herald Square - New York NY (W)\"],[\"80t" +"h & York - New York NY (W)\"],[\"Marriott Marquis - Lobby - New York NY\"],[\"Seco" +"nd @ 81st - New York NY (W)\"],[\"52nd & Seventh - New York NY (W)\"],[\"165 Broad" +"way - 1 Liberty - New York NY (W)\"],[\"54th & Broadway - New York NY (W)\"],[\"Li" +"mited Brands-NYC - New York NY\"],[\"63rd & Broadway - New York NY (W)\"],[\"2 Col" +"umbus Ave. - New York NY (W)\"],[\"70th & Broadway - New York NY (W)\"],[\"Broadwa" +"y @ 81st - New York NY (W)\"],[\"Fashion Inst of Technology - New York NY\"]]}}" +msgstr "" + +msgid "" +"Your Web browser sends a request to the protocol adapter via Socket.IO, the pr" +"otocol adapter sends it to the Droonga engine via fluent protocol, the engine " +"returns the search result to the protocol adapter, and the protocol adapter se" +"nds back the search result to the client." +msgstr "" +"Web ブラウザから Socket.IO 経由でリクエストが Protocol Adapter に送信され、それが Engine に送られ、検索結果が Pr" +"otocol Adapter に返され、さらに Web ブラウザに返されます。" + +msgid "" +"Next, try a fulltext search request like the previous section, to find stores " +"with the town name \"Columbus\".\n" +"Modify the parameter given to the `socket.emit()` method in the `index.html`, " +"like following:" +msgstr "" +"今度は全文検索を行ってみましょう。先ほどと同様に「Columbus」を店名に含む店舗を検索します。`index.html` の `socket.emit()" +"` の呼び出しを書き換え、以下の様な `index.html` を用意します。" + +msgid "" +" <html>\n" +" <head>\n" +" <script src=\"/socket.io/socket.io.js\"></script>\n" +" <script>\n" +" var socket = io.connect();\n" +" socket.on('search.result', function (data) {\n" +" document.body.textContent += JSON.stringify(data);\n" +" });\n" +" socket.emit('search', { queries: {\n" +" result: {\n" +" source: 'Store',\n" +" condition: {\n" +" query: 'Columbus',\n" +" matchTo: '_key'\n" +" },\n" +" output: {\n" +" elements: [\n" +" 'startTime',\n" +" 'elapsedTime',\n" +" 'count',\n" +" 'attributes',\n" +" 'records'\n" +" ],\n" +" attributes: ['_key'],\n" +" limit: -1\n" +" }\n" +" }\n" +" }});\n" +" </script>\n" +" </head>\n" +" <body>\n" +" </body>\n" +" </html>" +msgstr "" + +msgid "" +"Reload the current page `http://192.0.2.1:3000` in your Web browser, then you'" +"ll see a search result like following:" +msgstr "ブラウザで再度 `http://192.0.2.1:3000` を開くと、以下のような検索結果が表示されます。" + +msgid "" +" {\"result\":{\"count\":2,\"records\":[[\"Columbus @ 67th - New York NY (W)\"],[\"2 " +"Columbus Ave. - New York NY (W)\"]]}}" +msgstr "" + +msgid "" +"OK, you've successfully created a client application which can send search req" +"uests and receive responses asynchronously via Socket.IO." +msgstr "このように、Socket.IO を利用して、リクエストとレスポンスを非同期に送受信する検索クライアントを作成することができました。" + +msgid "## Conclusion" +msgstr "## まとめ" + +msgid "" +"In this tutorial, you did setup both packages [fluent-plugin-droonga][] and [e" +"xpress-droonga][] which construct [Droonga][] service on a [Ubuntu Linux][Ubun" +"tu].\n" +"Moreover, you built a search system based on a protocol adapter with a Droonga" +" engine, and successfully searched." +msgstr "" +"[Ubuntu Linux][Ubuntu] 上に [Droonga][] を構成するパッケージである [fluent-plugin-droonga][] " +"と [express-droonga][] をセットアップしました。\n" +"これらのパッケージを利用することで、Protocol Adapter と Droonga Engine からなるシステムを構築し、実際に検索を行いました。" + +msgid "" +" [Ubuntu]: http://www.ubuntu.com/\n" +" [Droonga]: https://droonga.org/\n" +" [fluent-plugin-droonga]: https://github.com/droonga/fluent-plugin-droonga\n" +" [express-droonga]: https://github.com/droonga/express-droonga\n" +" [Groonga]: http://groonga.org/\n" +" [Ruby]: http://www.ruby-lang.org/\n" +" [nvm]: https://github.com/creationix/nvm\n" +" [Socket.IO]: http://socket.io/\n" +" [Fluentd]: http://fluentd.org/\n" +" [Node.js]: http://nodejs.org/" msgstr "" Modified: ja/tutorial/index.md (+190 -130) =================================================================== --- ja/tutorial/index.md 2013-12-25 13:39:29 +0900 (4b0c755) +++ ja/tutorial/index.md 2013-12-25 14:39:29 +0900 (382af1a) @@ -30,7 +30,6 @@ Droonga は複数のコンポーネントから構成されています。ユー Droonga Engine は Droonga における分散データ処理の要となるコンポーネントです。リクエストに基いて実際のデータ処理を行います。 このコンポーネントは [Fluentd] のプラグインとして実装されており、 [fluent-plugin-droonga][] パッケージとして提供されます。 - [fluent-plugin-droonga][] は検索エンジンとして、オープンソースのカラムストア機能付き全文検索エンジン [Groonga][] を使用しています。 #### Protocol Adapter @@ -41,7 +40,6 @@ Protocol Adapter は、Droonga を様々なプロトコルで利用できるよ Droonga Engine は fluentd プロトコルで通信を行います。Protocol Adapter は、ユーザがアプリケーションを構築する際に利用しやすいよう、 Droonga Engine の機能を HTTP や Socket.IO などのインタフェースで提供します。 - ## チュートリアルでつくるシステムの全体像 チュートリアルでは、以下の様な構成のシステムを構築します。 @@ -54,24 +52,27 @@ Droonga Engine は fluentd プロトコルで通信を行います。Protocol Ad \--------------------------------------------------/ - この部分を構築します + この部分を構築します ユーザは Protocol Adapter に、Web ブラウザなどを用いて接続します。Protocol Adapter は Droonga Engine へリクエストを送信します。実際の検索処理は Droonga Engine が行います。検索結果は、Droonga Engine から Protocol Adapter に渡され、最終的にユーザに返ります。 -例として、たい焼き屋を検索できるデータベースシステムを作成することにします。 -[groongaで高速な位置情報検索](http://www.clear-code.com/blog/2011/9/13.html) に出てくるたいやき屋データをもとに、変更を加えたデータを利用します。 +例として、[ニューヨークにあるのスターバックスの店舗](http://geocommons.com/overlays/430038)を検索できるデータベースシステムを作成することにします。 ## 実験用のマシンを用意する -本チュートリアルでは、 [さくらのクラウド](http://cloud.sakura.ad.jp/) に `Ubuntu Server 13.10 64bit` をセットアップし、その上に Droonga による検索システムを構築します。 -Ubuntu Server のセットアップが完了し、コンソールにアクセス出来る状態になったと仮定し、以降の手順を説明していきます。 +まずコンピュータを調達しましょう。このチュートリアルでは、既存のコンピュータにDroongaによる検索システムを構築する手順を解説します。 +以降の説明は基本的に、[DigitalOcean](https://www.digitalocean.com/)で `Ubuntu 13.10 x64` の仮想マシンのセットアップを完了し、コンソールにアクセスできる状態になった後を前提として進めます。 + +注意:Droongaが必要とするパッケージをインストールする前に、マシンが2GB以上のメモリを備えていることを確認して下さい。メモリが不足していると、ビルド時にエラーが出て、ビルドに失敗することがあります。 ## セットアップに必要なパッケージをインストールする Droonga をセットアップするために必要になるパッケージをインストールします。 - $ sudo apt-get install -y ruby ruby-dev build-essential nodejs npm + # apt-get update + # apt-get -y upgrade + # apt-get install -y ruby ruby-dev build-essential nodejs npm ## Droonga Engine を構築する @@ -80,17 +81,16 @@ Droonga Engine は、データベースを保持し、実際の検索を担当 ### fluent-plugin-droonga をインストールする - $ sudo gem install fluent-plugin-droonga + # gem install fluent-plugin-droonga Droonga Engine を構築するのに必要なパッケージがセットアップできました。引き続き設定に移ります。 - ### Droonga Engine を起動するための設定ファイルを用意する まず Droonga Engine 用のディレクトリを作成します。 - $ mkdir engine - $ cd engine + # mkdir engine + # cd engine 以下の内容で `fluentd.conf` と `catalog.json` を作成します。 @@ -100,8 +100,8 @@ fluentd.conf: type forward port 24224 </source> - <match taiyaki.message> - name localhost:24224/taiyaki + <match starbucks.message> + name localhost:24224/starbucks type droonga </match> <match output.message> @@ -112,15 +112,15 @@ catalog.json: { "effective_date": "2013-09-01T00:00:00Z", - "zones": ["localhost:24224/taiyaki"], + "zones": ["localhost:24224/starbucks"], "farms": { - "localhost:24224/taiyaki": { + "localhost:24224/starbucks": { "device": ".", "capacity": 10 } }, "datasets": { - "Taiyaki": { + "Starbucks": { "workers": 0, "plugins": ["search", "groonga", "add"], "number_of_replicas": 2, @@ -132,8 +132,8 @@ catalog.json: "weight": 50, "partitions": { "2013-09-01": [ - "localhost:24224/taiyaki.000", - "localhost:24224/taiyaki.001" + "localhost:24224/starbucks.000", + "localhost:24224/starbucks.001" ] } }, @@ -141,8 +141,8 @@ catalog.json: "weight": 50, "partitions": { "2013-09-01": [ - "localhost:24224/taiyaki.002", - "localhost:24224/taiyaki.003" + "localhost:24224/starbucks.002", + "localhost:24224/starbucks.003" ] } } @@ -154,16 +154,16 @@ catalog.json: } } -この `catalog.json` では、 `Taiyaki` データセットを定義し、2組のレプリカ×2個のパーティションで構成するよう指示しています。 +この `catalog.json` では、 `Starbucks` データセットを定義し、2組のレプリカ×2個のパーティションで構成するよう指示しています。 この例では、全てのレプリカ及びパーティションは、ローカル(一つの `fluent-plugin-droonga` の管理下)に配置します。 -`catalog.json` の詳細については [catalog.json](/reference/catalog) を参照してください。 +`catalog.json` の詳細については [catalog.json](/ja/reference/catalog) を参照してください。 ### fluent-plugin-droonga を起動する 以下のようにして fluentd-plugin-droonga を起動します。 - $ fluentd --config fluentd.conf + # fluentd --config fluentd.conf 2013-11-12 14:14:20 +0900 [info]: starting fluentd-0.10.40 2013-11-12 14:14:20 +0900 [info]: reading config file path="fluentd.conf" 2013-11-12 14:14:20 +0900 [info]: gem 'fluent-plugin-droonga' version '0.0.1' @@ -173,8 +173,8 @@ catalog.json: type forward port 24224 </source> - <match taiyaki.message> - name localhost:24224/taiyaki + <match starbucks.message> + name localhost:24224/starbucks type droonga </match> <match output.message> @@ -182,72 +182,76 @@ catalog.json: </match> </ROOT> 2013-11-12 14:14:20 +0900 [info]: adding source type="forward" - 2013-11-12 14:14:20 +0900 [info]: adding match pattern="taiyaki.message" type="droonga" + 2013-11-12 14:14:20 +0900 [info]: adding match pattern="starbucks.message" type="droonga" 2013-11-12 14:14:20 +0900 [info]: adding match pattern="output.message" type="stdout" 2013-11-12 14:14:20 +0900 [info]: listening fluent socket on 0.0.0.0:24224 ### データベースを作成する Dronga Engine が起動したので、データを投入しましょう。 -スキーマを定義した `ddl.jsons` と、たいやき屋のデータ `shops.jsons` を用意します。 +スキーマを定義した `ddl.jsons` と、店舗のデータ `stores.jsons` を用意します。 ddl.jsons: - {"id":"ddl:0","dataset":"Taiyaki","type":"table_create","replyTo":"localhost:24224/output","body":{"name":"Shop","flags":"TABLE_HASH_KEY","key_type":"ShortText"}} - {"id":"ddl:1","dataset":"Taiyaki","type":"column_create","replyTo":"localhost:24224/output","body":{"table":"Shop","name":"location","flags":"COLUMN_SCALAR","type":"WGS84GeoPoint"}} - {"id":"ddl:2","dataset":"Taiyaki","type":"table_create","replyTo":"localhost:24224/output","body":{"name":"Location","flags":"TABLE_PAT_KEY","key_type":"WGS84GeoPoint"}} - {"id":"ddl:3","dataset":"Taiyaki","type":"column_create","replyTo":"localhost:24224/output","body":{"table":"Location","name":"shop","flags":"COLUMN_INDEX","type":"Shop","source":"location"}} - {"id":"ddl:4","dataset":"Taiyaki","type":"table_create","replyTo":"localhost:24224/output","body":{"name":"Term","flags":"TABLE_PAT_KEY","key_type":"ShortText","default_tokenizer":"TokenBigram","normalizer":"NormalizerAuto"}} - {"id":"ddl:5","dataset":"Taiyaki","type":"column_create","replyTo":"localhost:24224/output","body":{"table":"Term","name":"shops__key","flags":"COLUMN_INDEX|WITH_POSITION","type":"Shop","source":"_key"}} - - -shops.jsons: - - {"id":"shops:0","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"根津のたいやき","values":{"location":"35.720253,139.762573"}}} - {"id":"shops:1","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"たい焼 カタオカ","values":{"location":"35.712521,139.715591"}}} - {"id":"shops:2","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"そばたいやき空","values":{"location":"35.683712,139.659088"}}} - {"id":"shops:3","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"車","values":{"location":"35.721516,139.706207"}}} - {"id":"shops:4","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"広瀬屋","values":{"location":"35.714844,139.685608"}}} - {"id":"shops:5","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"さざれ","values":{"location":"35.714653,139.685043"}}} - {"id":"shops:6","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"おめで鯛焼き本舗錦糸町東急店","values":{"location":"35.700516,139.817154"}}} - {"id":"shops:7","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"尾長屋 錦糸町店","values":{"location":"35.698254,139.81105"}}} - {"id":"shops:8","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"たいやき工房白家 阿佐ヶ谷店","values":{"location":"35.705517,139.638611"}}} - {"id":"shops:9","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"たいやき本舗 藤家 阿佐ヶ谷店","values":{"location":"35.703938,139.637115"}}} - {"id":"shops:10","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"みよし","values":{"location":"35.644539,139.537323"}}} - {"id":"shops:11","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"寿々屋 菓子","values":{"location":"35.628922,139.695755"}}} - {"id":"shops:12","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"たい焼き / たつみや","values":{"location":"35.665501,139.638657"}}} - {"id":"shops:13","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"たい焼き鉄次 大丸東京店","values":{"location":"35.680912,139.76857"}}} - {"id":"shops:14","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"吾妻屋","values":{"location":"35.700817,139.647598"}}} - {"id":"shops:15","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"ほんま門","values":{"location":"35.722736,139.652573"}}} - {"id":"shops:16","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"浪花家","values":{"location":"35.730061,139.796234"}}} - {"id":"shops:17","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"代官山たい焼き黒鯛","values":{"location":"35.650345,139.704834"}}} - {"id":"shops:18","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"たいやき神田達磨 八重洲店","values":{"location":"35.681461,139.770599"}}} - {"id":"shops:19","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"柳屋 たい焼き","values":{"location":"35.685341,139.783981"}}} - {"id":"shops:20","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"たい焼き写楽","values":{"location":"35.716969,139.794846"}}} - {"id":"shops:21","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"たかね 和菓子","values":{"location":"35.698601,139.560913"}}} - {"id":"shops:22","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"たい焼き ちよだ","values":{"location":"35.642601,139.652817"}}} - {"id":"shops:23","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"ダ・カーポ","values":{"location":"35.627346,139.727356"}}} - {"id":"shops:24","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"松島屋","values":{"location":"35.640556,139.737381"}}} - {"id":"shops:25","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"銀座 かずや","values":{"location":"35.673508,139.760895"}}} - {"id":"shops:26","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"ふるや古賀音庵 和菓子","values":{"location":"35.680603,139.676071"}}} - {"id":"shops:27","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"蜂の家 自由が丘本店","values":{"location":"35.608021,139.668106"}}} - {"id":"shops:28","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"薄皮たい焼き あづきちゃん","values":{"location":"35.64151,139.673203"}}} - {"id":"shops:29","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"横浜 くりこ庵 浅草店","values":{"location":"35.712013,139.796829"}}} - {"id":"shops:30","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"夢ある街のたいやき屋さん戸越銀座店","values":{"location":"35.616199,139.712524"}}} - {"id":"shops:31","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"何故屋","values":{"location":"35.609039,139.665833"}}} - {"id":"shops:32","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"築地 さのきや","values":{"location":"35.66592,139.770721"}}} - {"id":"shops:33","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"しげ田","values":{"location":"35.672626,139.780273"}}} - {"id":"shops:34","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"にしみや 甘味処","values":{"location":"35.671825,139.774628"}}} - {"id":"shops:35","replyTo":"localhost:24224/output","dataset":"Taiyaki","type":"add","body":{"table":"Shop","key":"たいやきひいらぎ","values":{"location":"35.647701,139.711517"}}} - - -fluentd を起動した状態で別の端末を開き、以下のようにして `ddl.jsons` と `shops.jsons` を投入します: - - $ fluent-cat taiyaki.message < ddl.jsons - $ fluent-cat taiyaki.message < shops.jsons - - -これで、たい焼きデータベースを検索するための Droonga Engine ができました。 + {"id":"ddl:0","dataset":"Starbucks","type":"table_create","replyTo":"localhost:24224/output","body":{"name":"Store","flags":"TABLE_HASH_KEY","key_type":"ShortText"}} + {"id":"ddl:1","dataset":"Starbucks","type":"column_create","replyTo":"localhost:24224/output","body":{"table":"Store","name":"location","flags":"COLUMN_SCALAR","type":"WGS84GeoPoint"}} + {"id":"ddl:2","dataset":"Starbucks","type":"table_create","replyTo":"localhost:24224/output","body":{"name":"Location","flags":"TABLE_PAT_KEY","key_type":"WGS84GeoPoint"}} + {"id":"ddl:3","dataset":"Starbucks","type":"column_create","replyTo":"localhost:24224/output","body":{"table":"Location","name":"store","flags":"COLUMN_INDEX","type":"Store","source":"location"}} + {"id":"ddl:4","dataset":"Starbucks","type":"table_create","replyTo":"localhost:24224/output","body":{"name":"Term","flags":"TABLE_PAT_KEY","key_type":"ShortText","default_tokenizer":"TokenBigram","normalizer":"NormalizerAuto"}} + {"id":"ddl:5","dataset":"Starbucks","type":"column_create","replyTo":"localhost:24224/output","body":{"table":"Term","name":"stores__key","flags":"COLUMN_INDEX|WITH_POSITION","type":"Store","source":"_key"}} + + +stores.jsons: + + {"id":"stores:0","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"1st Avenue & 75th St. - New York NY (W)","values":{"location":"40.770262,-73.954798"}}} + {"id":"stores:1","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"76th & Second - New York NY (W)","values":{"location":"40.771056,-73.956757"}}} + {"id":"stores:2","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"2nd Ave. & 9th Street - New York NY","values":{"location":"40.729445,-73.987471"}}} + {"id":"stores:3","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"15th & Third - New York NY (W)","values":{"location":"40.733946,-73.9867"}}} + {"id":"stores:4","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"41st and Broadway - New York NY (W)","values":{"location":"40.755111,-73.986225"}}} + {"id":"stores:5","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"84th & Third Ave - New York NY (W)","values":{"location":"40.777485,-73.954979"}}} + {"id":"stores:6","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"150 E. 42nd Street - New York NY (W)","values":{"location":"40.750784,-73.975582"}}} + {"id":"stores:7","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"West 43rd and Broadway - New York NY (W)","values":{"location":"40.756197,-73.985624"}}} + {"id":"stores:8","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"Macy's 35th Street Balcony - New York NY","values":{"location":"40.750703,-73.989787"}}} + {"id":"stores:9","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"Macy's 6th Floor - Herald Square - New York NY (W)","values":{"location":"40.750703,-73.989787"}}} + {"id":"stores:10","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"Herald Square- Macy's - New York NY","values":{"location":"40.750703,-73.989787"}}} + {"id":"stores:11","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"Macy's 5th Floor - Herald Square - New York NY (W)","values":{"location":"40.750703,-73.989787"}}} + {"id":"stores:12","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"80th & York - New York NY (W)","values":{"location":"40.772204,-73.949862"}}} + {"id":"stores:13","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"Columbus @ 67th - New York NY (W)","values":{"location":"40.774009,-73.981472"}}} + {"id":"stores:14","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"45th & Broadway - New York NY (W)","values":{"location":"40.75766,-73.985719"}}} + {"id":"stores:15","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"Marriott Marquis - Lobby - New York NY","values":{"location":"40.759123,-73.984927"}}} + {"id":"stores:16","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"Second @ 81st - New York NY (W)","values":{"location":"40.77466,-73.954447"}}} + {"id":"stores:17","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"52nd & Seventh - New York NY (W)","values":{"location":"40.761829,-73.981141"}}} + {"id":"stores:18","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"1585 Broadway (47th) - New York NY (W)","values":{"location":"40.759806,-73.985066"}}} + {"id":"stores:19","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"85th & First - New York NY (W)","values":{"location":"40.776101,-73.949971"}}} + {"id":"stores:20","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"92nd & 3rd - New York NY (W)","values":{"location":"40.782606,-73.951235"}}} + {"id":"stores:21","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"165 Broadway - 1 Liberty - New York NY (W)","values":{"location":"40.709727,-74.011395"}}} + {"id":"stores:22","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"1656 Broadway - New York NY (W)","values":{"location":"40.762434,-73.983364"}}} + {"id":"stores:23","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"54th & Broadway - New York NY (W)","values":{"location":"40.764275,-73.982361"}}} + {"id":"stores:24","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"Limited Brands-NYC - New York NY","values":{"location":"40.765219,-73.982025"}}} + {"id":"stores:25","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"19th & 8th - New York NY (W)","values":{"location":"40.743218,-74.000605"}}} + {"id":"stores:26","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"60th & Broadway-II - New York NY (W)","values":{"location":"40.769196,-73.982576"}}} + {"id":"stores:27","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"63rd & Broadway - New York NY (W)","values":{"location":"40.771376,-73.982709"}}} + {"id":"stores:28","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"195 Broadway - New York NY (W)","values":{"location":"40.710703,-74.009485"}}} + {"id":"stores:29","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"2 Broadway - New York NY (W)","values":{"location":"40.704538,-74.01324"}}} + {"id":"stores:30","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"2 Columbus Ave. - New York NY (W)","values":{"location":"40.769262,-73.984764"}}} + {"id":"stores:31","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"NY Plaza - New York NY (W)","values":{"location":"40.702802,-74.012784"}}} + {"id":"stores:32","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"36th and Madison - New York NY (W)","values":{"location":"40.748917,-73.982683"}}} + {"id":"stores:33","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"125th St. btwn Adam Clayton & FDB - New York NY","values":{"location":"40.808952,-73.948229"}}} + {"id":"stores:34","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"70th & Broadway - New York NY (W)","values":{"location":"40.777463,-73.982237"}}} + {"id":"stores:35","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"2138 Broadway - New York NY (W)","values":{"location":"40.781078,-73.981167"}}} + {"id":"stores:36","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"118th & Frederick Douglas Blvd. - New York NY (W)","values":{"location":"40.806176,-73.954109"}}} + {"id":"stores:37","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"42nd & Second - New York NY (W)","values":{"location":"40.750069,-73.973393"}}} + {"id":"stores:38","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"Broadway @ 81st - New York NY (W)","values":{"location":"40.784972,-73.978987"}}} + {"id":"stores:39","replyTo":"localhost:24224/output","dataset":"Starbucks","type":"add","body":{"table":"Store","key":"Fashion Inst of Technology - New York NY","values":{"location":"40.746948,-73.994557"}}} + + +fluentd を起動した状態で別の端末を開き、以下のようにして `ddl.jsons` と `stores.jsons` を投入します: + + # fluent-cat starbucks.message < ddl.jsons + # fluent-cat starbucks.message < stores.jsons + + +これで、スターバックスの店舗のデータベースを検索するための Droonga Engine ができました。 引き続き Protocol Adapter を構築して、検索リクエストを受け付けられるようにしましょう。 @@ -257,9 +261,9 @@ Protocol Adapter を構築するために、 `express-droonga` を使用しま ### express-droonga をインストールする - $ cd ~ - $ mkdir protocol-adapter - $ cd protocol-adapter + # cd ~ + # mkdir protocol-adapter + # cd protocol-adapter 以下のような `package.json` を用意します。 @@ -297,8 +301,8 @@ application.js: application.droonga({ prefix: '/droonga', - tag: 'taiyaki', - defaultDataset: 'Taiyaki', + tag: 'starbucks', + defaultDataset: 'Starbucks', server: server, // this is required to initialize Socket.IO API! plugins: [ droonga.API_REST, @@ -310,78 +314,138 @@ application.js: `application.js` を実行します。 - $ nodejs application.js + # nodejs application.js info - socket.io started -### 動作を確認 +### HTTPでの同期的な検索のリクエスト 準備が整いました。 Protocol Adapter に向けて HTTP 経由でリクエストを発行し、データベースに問い合わせを行ってみましょう。まずは `Shops` テーブルの中身を取得してみます。以下のようなリクエストを用います。(`attributes=_key` を指定しているのは「検索結果に `_key` 値を含めて返してほしい」という意味です。これがないと、`records` に何も値がないレコードが返ってきてしまいます。`attributes` パラメータには `,` 区切りで複数の属性を指定することができます。`attributes=_key,location` と指定することで、緯度経度もレスポンスとして受け取ることができます) - $ curl "http://localhost:3000/droonga/tables/Shop?attributes=_key&limit=-1" + # curl "http://localhost:3000/droonga/tables/Store?attributes=_key&limit=-1" { "result": { - "count": 36, + "count": 40, "records": [ [ - "たい焼 カタオカ" + "76th & Second - New York NY (W)" + ], + [ + "15th & Third - New York NY (W)" + ], + [ + "41st and Broadway - New York NY (W)" + ], + [ + "West 43rd and Broadway - New York NY (W)" + ], + [ + "Macy's 6th Floor - Herald Square - New York NY (W)" + ], + [ + "Herald Square- Macy's - New York NY" + ], + [ + "Columbus @ 67th - New York NY (W)" + ], + [ + "45th & Broadway - New York NY (W)" + ], + [ + "1585 Broadway (47th) - New York NY (W)" + ], + [ + "85th & First - New York NY (W)" + ], + [ + "92nd & 3rd - New York NY (W)" ], [ - "根津のたいやき" + "1656 Broadway - New York NY (W)" ], [ - "そばたいやき空" + "19th & 8th - New York NY (W)" ], [ - "さざれ" + "60th & Broadway-II - New York NY (W)" ], [ - "おめで鯛焼き本舗錦糸町東急店" + "195 Broadway - New York NY (W)" ], [ - "尾長屋 錦糸町店" + "2 Broadway - New York NY (W)" ], [ - "たいやき本舗 藤家 阿佐ヶ谷店" + "NY Plaza - New York NY (W)" ], [ - "みよし" + "36th and Madison - New York NY (W)" ], [ - "たい焼き / たつみや" + "125th St. btwn Adam Clayton & FDB - New York NY" ], [ - "吾妻屋" + "2138 Broadway - New York NY (W)" ], [ - "たいやき神田達磨 八重洲店" + "118th & Frederick Douglas Blvd. - New York NY (W)" ], [ - "車" + "42nd & Second - New York NY (W)" ], [ - "広瀬屋" + "1st Avenue & 75th St. - New York NY (W)" ], [ - "たいやき工房白家 阿佐ヶ谷店" + "2nd Ave. & 9th Street - New York NY" ], [ - "寿々屋 菓子" + "84th & Third Ave - New York NY (W)" ], [ - "たい焼き鉄次 大丸東京店" + "150 E. 42nd Street - New York NY (W)" ], [ - "ほんま門" + "Macy's 35th Street Balcony - New York NY" ], [ - "浪花家" + "Macy's 5th Floor - Herald Square - New York NY (W)" ], [ - "代官山たい焼き黒鯛" + "80th & York - New York NY (W)" ], [ - "ダ・カーポ" + "Marriott Marquis - Lobby - New York NY" + ], + [ + "Second @ 81st - New York NY (W)" + ], + [ + "52nd & Seventh - New York NY (W)" + ], + [ + "165 Broadway - 1 Liberty - New York NY (W)" + ], + [ + "54th & Broadway - New York NY (W)" + ], + [ + "Limited Brands-NYC - New York NY" + ], + [ + "63rd & Broadway - New York NY (W)" + ], + [ + "2 Columbus Ave. - New York NY (W)" + ], + [ + "70th & Broadway - New York NY (W)" + ], + [ + "Broadway @ 81st - New York NY (W)" + ], + [ + "Fashion Inst of Technology - New York NY" ] ] } @@ -389,19 +453,18 @@ application.js: `count` の値からデータが全部で 36 件あることがわかります。`records` に配列として検索結果が入っています。 -もう少し複雑なクエリを試してみましょう。例えば、店名に「阿佐ヶ谷」を含むたいやき屋を検索します。`query` パラメータにクエリ `阿佐ヶ谷` を URL エンコードした `%E9%98%BF%E4%BD%90%E3%83%B6%E8%B0%B7` を、`match_to` パラメータに検索対象として `_key` を指定し、以下のようなリクエストを発行します。 - +もう少し複雑なクエリを試してみましょう。例えば、店名に「Columbus」を含む店舗を検索します。`query` パラメータにクエリ `Columbus` を、`match_to` パラメータに検索対象として `_key` を指定し、以下のようなリクエストを発行します。 - $ curl "http://localhost:3000/droonga/tables/Shop?query=%E9%98%BF%E4%BD%90%E3%83%B6%E8%B0%B7&match_to=_key&attributes=_key&limit=-1" + # curl "http://localhost:3000/droonga/tables/Store?query=Columbus&match_to=_key&attributes=_key&limit=-1" { "result": { "count": 2, "records": [ [ - "たいやき工房白家 阿佐ヶ谷店" + "Columbus @ 67th - New York NY (W)" ], [ - "たいやき本舗 藤家 阿佐ヶ谷店" + "2 Columbus Ave. - New York NY (W)" ] ] } @@ -419,7 +482,6 @@ Droonga の Protocol Adapter は、 REST API だけでなく、 [Socket.IO][] Protocol Adapter から `index.html` を配信し、Webブラウザに渡すことにしましょう。 `protocol-adapter` ディレクトリの下に以下の内容の `index.html` を配置します。 - index.html: <html> @@ -432,7 +494,7 @@ index.html: }); socket.emit('search', { queries: { result: { - source: 'Shop', + source: 'Store', output: { elements: [ 'startTime', @@ -473,8 +535,8 @@ application.js: application.droonga({ prefix: '/droonga', - tag: 'taiyaki', - defaultDataset: 'Taiyaki', + tag: 'starbucks', + defaultDataset: 'Starbucks', server: server, // this is required to initialize Socket.IO API! plugins: [ droonga.API_REST, @@ -484,23 +546,22 @@ application.js: ] }); - //========== 追加箇所ここから ========== + //============== INSERTED ============== application.get('/', function(req, res) { res.sendfile(__dirname + '/index.html'); }); - //========== 追加箇所ここまで ========== + //============= /INSERTED ============== Web ブラウザにサーバの IP アドレスを入れて、リクエストを送信してみましょう。 以降、サーバの IP アドレスが `192.0.2.1` であったとします。 `http://192.0.2.1:3000/` をリクエストすると、先の `index.html` が返されるようになります。 - Webブラウザから `http://192.0.2.1:3000` を開いてみてください。以下のように検索結果が表示されれば成功です。 - "result":{"count":36,"records":[["たい焼 カタオカ"],["根津のたいやき"],["そばたいやき空"],["さざれ"],["おめで鯛焼き本舗錦糸町東急店"],["尾長屋 錦糸町店"],["たいやき本舗 藤家 阿佐ヶ谷店"],["みよし"],["たい焼き / たつみや"],["吾妻屋"],["たいやき神田達磨 八重洲店"],["車"],["広瀬屋"],["たいやき工房白家 阿佐ヶ谷店"],["寿々屋 菓子"],["たい焼き鉄次 大丸東京店"],["ほんま門"],["浪花家"],["代官山たい焼き黒鯛"],["ダ・カーポ"]]}} + {"result":{"count":40,"records":[["76th & Second - New York NY (W)"],["15th & Third - New York NY (W)"],["41st and Broadway - New York NY (W)"],["West 43rd and Broadway - New York NY (W)"],["Macy's 6th Floor - Herald Square - New York NY (W)"],["Herald Square- Macy's - New York NY"],["Columbus @ 67th - New York NY (W)"],["45th & Broadway - New York NY (W)"],["1585 Broadway (47th) - New York NY (W)"],["85th & First - New York NY (W)"],["92nd & 3rd - New York NY (W)"],["1656 Broadway - New York NY (W)"],["19th & 8th - New York NY (W)"],["60th & Broadway-II - New York NY (W)"],["195 Broadway - New York NY (W)"],["2 Broadway - New York NY (W)"],["NY Plaza - New York NY (W)"],["36th and Madison - New York NY (W)"],["125th St. btwn Adam Clayton & FDB - New York NY"],["2138 Broadway - New York NY (W)"],["118th & Frederick Douglas Blvd. - New York NY (W)"],["42nd & Second - New York NY (W)"],["1st Avenue & 75th St. - New York NY (W)"],["2nd Ave. & 9th Street - New York NY"],["84 th & Thi rd Ave - New York NY (W)"],["150 E. 42nd Street - New York NY (W)"],["Macy's 35th Street Balcony - New York NY"],["Macy's 5th Floor - Herald Square - New York NY (W)"],["80th & York - New York NY (W)"],["Marriott Marquis - Lobby - New York NY"],["Second @ 81st - New York NY (W)"],["52nd & Seventh - New York NY (W)"],["165 Broadway - 1 Liberty - New York NY (W)"],["54th & Broadway - New York NY (W)"],["Limited Brands-NYC - New York NY"],["63rd & Broadway - New York NY (W)"],["2 Columbus Ave. - New York NY (W)"],["70th & Broadway - New York NY (W)"],["Broadway @ 81st - New York NY (W)"],["Fashion Inst of Technology - New York NY"]]}} Web ブラウザから Socket.IO 経由でリクエストが Protocol Adapter に送信され、それが Engine に送られ、検索結果が Protocol Adapter に返され、さらに Web ブラウザに返されます。 -今度は全文検索を行ってみましょう。先ほどと同様に「阿佐ヶ谷」を店名に含むたいやき屋を検索します。`index.html` の `socket.emit()` の呼び出しを書き換え、以下の様な `index.html` を用意します。 +今度は全文検索を行ってみましょう。先ほどと同様に「Columbus」を店名に含む店舗を検索します。`index.html` の `socket.emit()` の呼び出しを書き換え、以下の様な `index.html` を用意します。 <html> <head> @@ -512,9 +573,9 @@ Web ブラウザから Socket.IO 経由でリクエストが Protocol Adapter }); socket.emit('search', { queries: { result: { - source: 'Shop', + source: 'Store', condition: { - query: '阿佐ヶ谷', + query: 'Columbus', matchTo: '_key' }, output: { @@ -538,7 +599,7 @@ Web ブラウザから Socket.IO 経由でリクエストが Protocol Adapter ブラウザで再度 `http://192.0.2.1:3000` を開くと、以下のような検索結果が表示されます。 - {"result":{"count":2,"records":[["たいやき工房白家 阿佐ヶ谷店"],["たいやき本舗 藤家 阿佐ヶ谷店"]]}} + {"result":{"count":2,"records":[["Columbus @ 67th - New York NY (W)"],["2 Columbus Ave. - New York NY (W)"]]}} このように、Socket.IO を利用して、リクエストとレスポンスを非同期に送受信する検索クライアントを作成することができました。 @@ -548,7 +609,6 @@ Web ブラウザから Socket.IO 経由でリクエストが Protocol Adapter [Ubuntu Linux][Ubuntu] 上に [Droonga][] を構成するパッケージである [fluent-plugin-droonga][] と [express-droonga][] をセットアップしました。 これらのパッケージを利用することで、Protocol Adapter と Droonga Engine からなるシステムを構築し、実際に検索を行いました。 - [Ubuntu]: http://www.ubuntu.com/ [Droonga]: https://droonga.org/ [fluent-plugin-droonga]: https://github.com/droonga/fluent-plugin-droonga -------------- next part -------------- HTML����������������������������...下载