droonga/droonga-engine

_keyをsourceにしたときのcolumn_listのsourceの値がGroonga互換じゃない

Closed this issue · 4 comments

kou commented

たぶん、この定義のテーブルのcolumn_listで再現できる。(実際に↓で試したわけではない。)

table_create Memos TABLE_PAT_KEY ShortText
table_create Terms TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram
column_create Terms index COLUMN_INDEX|WITH_POSITION Memos _key

GroongaとDroongaで試してみるとわかるはず。

Groonga

$ mkdir /tmp/databases/
$ groonga -n /tmp/databases/db quit
$ groonga -p 10041 -d --protocol http /tmp/databases/db
$ endpoint="http://node0:10041"
$ curl "$endpoint/d/table_create?name=Memos&flags=TABLE_PAT_KEY&key_type=ShortText" | jq "."
$ curl "$endpoint/d/table_create?name=Terms&flags=TABLE_PAT_KEY&key_type=ShortText&default_tokenizer=TokenBigram" | jq "."
$ curl "$endpoint/d/column_create?table=Terms&name=index&flags=COLUMN_INDEX|WITH_POSITION&type=Memos&source=_key" | jq "."
$ curl "$endpoint/d/column_list?table=Terms" | jq "."
[
  [
    0,
    1415339682.28546,
    0.00017237663269043
  ],
  [
    [
      [
        "id",
        "UInt32"
      ],
      [
        "name",
        "ShortText"
      ],
      [
        "path",
        "ShortText"
      ],
      [
        "type",
        "ShortText"
      ],
      [
        "flags",
        "ShortText"
      ],
      [
        "domain",
        "ShortText"
      ],
      [
        "range",
        "ShortText"
      ],
      [
        "source",
        "ShortText"
      ]
    ],
    [
      257,
      "_key",
      "",
      "",
      "COLUMN_SCALAR",
      "Terms",
      "ShortText",
      []
    ],
    [
      258,
      "index",
      "/tmp/databases/db.0000102",
      "index",
      "COLUMN_INDEX|WITH_POSITION|PERSISTENT",
      "Terms",
      "Memos",
      [
        "Memos"
      ]
    ]
  ]
]

Droonga

$ endpoint="http://node0:10041"
$ curl "$endpoint/d/table_create?name=Memos&flags=TABLE_PAT_KEY&key_type=ShortText" | jq "."
$ curl "$endpoint/d/table_create?name=Terms&flags=TABLE_PAT_KEY&key_type=ShortText&default_tokenizer=TokenBigram" | jq "."
$ curl "$endpoint/d/column_create?table=Terms&name=index&flags=COLUMN_INDEX|WITH_POSITION&type=Memos&source=_key" | jq "."
$ curl "$endpoint/d/column_list?table=Terms" | jq "."
[
  [
    0,
    1415339895.156586,
    0.0008332729339599609
  ],
  [
    [
      [
        "id",
        "UInt32"
      ],
      [
        "name",
        "ShortText"
      ],
      [
        "path",
        "ShortText"
      ],
      [
        "type",
        "ShortText"
      ],
      [
        "flags",
        "ShortText"
      ],
      [
        "domain",
        "ShortText"
      ],
      [
        "range",
        "ShortText"
      ],
      [
        "source",
        "ShortText"
      ]
    ],
    [
      258,
      "index",
      "/home/droonga-engine/droonga/databases/000/db.0000102",
      "index",
      "COLUMN_INDEX|WITH_POSITION",
      "Terms",
      "Memos",
      [
        "_key"
      ]
    ]
  ]
]

レスポンスが同じになるように修正しました。

なお、仮想カラムのpathまでもが常に「/path/to/column」に正規化されてしまうため、drntestのリリース版ではテストが失敗してしまいます。
(masterであれば通るように直しました)

kou commented

drntestをリリースしましょう!