null+****@clear*****
null+****@clear*****
2010年 10月 28日 (木) 14:15:33 JST
Kouhei Sutou 2010-10-28 05:15:33 +0000 (Thu, 28 Oct 2010)
New Revision: e79a7997e611a737b0d7cc16367f4bf37f573333
Merged c7b2733: Merge branch 'master' of github.com:groonga/groonga
Merged bf59ab7: Merge branch 'master' of github.com:groonga/groonga
Log:
query escalation threshold -> match escalation threshold.
Modified files:
configure.ac
doc/ja/source/commands/select.txt
doc/ja/source/execfile.txt
doc/ja/source/troubleshooting/different_results_with_the_same_keyword.txt
groonga.h
lib/ctx.c
lib/expr.c
lib/ii.c
lib/proc.c
lib/ql.h
lib/query.c
src/groonga.c
Modified: configure.ac (+7 -7)
===================================================================
--- configure.ac 2010-10-21 09:30:37 +0000 (ca66250)
+++ configure.ac 2010-10-28 05:15:33 +0000 (deb4309)
@@ -180,13 +180,13 @@ AC_ARG_WITH(default_encoding,
GROONGA_DEFAULT_ENCODING="utf8")
AC_DEFINE_UNQUOTED(GROONGA_DEFAULT_ENCODING, "$GROONGA_DEFAULT_ENCODING", "specified default encoding")
-# default query escalation threshold
-AC_ARG_WITH(query_escalation_threshold,
- [AS_HELP_STRING([--with-query-escalation-threshold=NUMBER],
- [specify groonga default query escalation threshold])],
- GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD="$withval",
- GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD="0")
-AC_DEFINE_UNQUOTED(GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD, $GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD, "specified query escalation threshold")
+# default match escalation threshold
+AC_ARG_WITH(match_escalation_threshold,
+ [AS_HELP_STRING([--with-match-escalation-threshold=NUMBER],
+ [specify groonga default match escalation threshold])],
+ GROONGA_DEFAULT_MATCH_ESCALATION_THRESHOLD="$withval",
+ GROONGA_DEFAULT_MATCH_ESCALATION_THRESHOLD="0")
+AC_DEFINE_UNQUOTED(GROONGA_DEFAULT_MATCH_ESCALATION_THRESHOLD, $GROONGA_DEFAULT_MATCH_ESCALATION_THRESHOLD, "specified match escalation threshold")
AC_CHECK_LIB(m, log, [M_LIBS="-lm"], [AC_MSG_ERROR("No libm found")])
AC_CHECK_LIB(pthread, pthread_mutex_init,
Modified: doc/ja/source/commands/select.txt (+6 -6)
===================================================================
--- doc/ja/source/commands/select.txt 2010-10-21 09:30:37 +0000 (dcadd3c)
+++ doc/ja/source/commands/select.txt 2010-10-28 05:15:33 +0000 (e767ba3)
@@ -17,7 +17,7 @@ select - テーブルの中から条件にマッチするレコードを検索
select table [match_columns [query [filter [scorer [sortby [output_columns
[offset [limit [drilldown [drilldown_sortby [drilldown_output_columns
[drilldown_offset [drilldown_limit [cache
- [query_escalation_threshold]]]]]]]]]]]]]]]
+ [match_escalation_threshold]]]]]]]]]]]]]]]
説明
----
@@ -167,13 +167,13 @@ a - b
検索結果をクエリキャッシュに残しません。キャッシュして再利用される可能性が低いクエリに対して用います。キャッシュ容量は有限です。有効なキャッシュが多くヒットするために、このパラメータは有効です。
-``query_escalation_threshold``
+``match_escalation_threshold``
- クエリをエスカレーションするかどうかの閾値を設定します。デフォルト値は0です。デフォルト値は以下のいずれかの方法で設定できます。
+ 検索の挙動をエスカレーションするかどうかの閾値を設定します。デフォルト値は0です。デフォルト値は以下のいずれかの方法で設定できます。
- * configureの--with-query-escalation-thresholdオプション
- * groongaコマンド起動時の--query-escalation-thresholdオプション
- * 設定ファイル中のquery-escalation-threshold設定項目
+ * configureの--with-match-escalation-thresholdオプション
+ * groongaコマンド起動時の--match-escalation-thresholdオプション
+ * 設定ファイル中のmatch-escalation-threshold設定項目
クエリのヒット件数が閾値を越えない場合は:ref:`spec_search` で説明している方法で検索方法をエスカレーションしてきます。
Modified: doc/ja/source/execfile.txt (+2 -2)
===================================================================
--- doc/ja/source/execfile.txt 2010-10-21 09:30:37 +0000 (1fc39b7)
+++ doc/ja/source/execfile.txt 2010-10-28 05:15:33 +0000 (7499d2e)
@@ -112,9 +112,9 @@ groongaのデータベースは、groonga実行ファイルかCライブラリ
キャッシュ数の最大値を指定します。(デフォルトは100です)
-.. cmdoption:: --default-query-escalation-threshold <threshold>
+.. cmdoption:: --default-match-escalation-threshold <threshold>
- クエリをエスカレーションする閾値を指定します。(デフォルトは0です)
+ 検索の挙動をエスカレーションする閾値を指定します。(デフォルトは0です)
引数
----
Modified: doc/ja/source/troubleshooting/different_results_with_the_same_keyword.txt (+2 -2)
===================================================================
--- doc/ja/source/troubleshooting/different_results_with_the_same_keyword.txt 2010-10-21 09:30:37 +0000 (a4682d1)
+++ doc/ja/source/troubleshooting/different_results_with_the_same_keyword.txt 2010-10-28 05:15:33 +0000 (dcc8681)
@@ -128,8 +128,8 @@ TokenBigramSplitSymbolAlphaトークナイザーを使う場合も重み付け
対策方法2: 閾値をあげる
-----------------------
-非わかち書き検索・部分一致検索を利用するかどうかの閾値は--with-query-escalation-threshold configureオプションで変更することができます。以下のように指定すると、100件以下のヒット数であれば、たとえ完全一致検索でヒットしても、非わかち書き検索・部分一致検索を行います。::
+非わかち書き検索・部分一致検索を利用するかどうかの閾値は--with-match-escalation-threshold configureオプションで変更することができます。以下のように指定すると、100件以下のヒット数であれば、たとえ完全一致検索でヒットしても、非わかち書き検索・部分一致検索を行います。::
- % ./configure --with-quer-escalation-threashold=100
+ % ./configure --with-match-escalation-threashold=100
この場合も対策方法1同様、検索ノイズが上位に現れる可能性が高くなることに注意してください。検索ノイズが多くなった場合は指定する値を低くする必要があります。
Modified: groonga.h (+22 -14)
===================================================================
--- groonga.h 2010-10-21 09:30:37 +0000 (ccb47b1)
+++ groonga.h 2010-10-28 05:15:33 +0000 (ab99d5f)
@@ -284,34 +284,42 @@ GRN_API grn_command_version grn_ctx_get_command_version(grn_ctx *ctx);
GRN_API grn_rc grn_ctx_set_command_version(grn_ctx *ctx, grn_command_version version);
/**
- * grn_ctx_get_query_escalation_threshold:
+ * grn_ctx_get_match_escalation_threshold:
*
- * クエリをエスカレーションする閾値を返します。
+ * 検索の挙動をエスカレーションする閾値を返します。エスカレー
+ * ションの詳細は検索の仕様に関するドキュメントを参照してく
+ * ださい。
**/
-GRN_API long long int grn_ctx_get_query_escalation_threshold(grn_ctx *ctx);
+GRN_API long long int grn_ctx_get_match_escalation_threshold(grn_ctx *ctx);
/**
- * grn_ctx_set_query_escalation_threshold:
- * @threshold: 変更後のクエリをエスカレーションする閾値を指定します。
+ * grn_ctx_set_match_escalation_threshold:
+ * @threshold: 変更後の検索の挙動をエスカレーションする閾値を指定します。
*
- * クエリをエスカレーションする閾値を変更します。
+ * 検索の挙動をエスカレーションする閾値を変更します。エスカレー
+ * ションの詳細は検索の仕様に関するドキュメントを参照してくだ
+ * さい。
**/
-GRN_API grn_rc grn_ctx_set_query_escalation_threshold(grn_ctx *ctx, long long int threshold);
+GRN_API grn_rc grn_ctx_set_match_escalation_threshold(grn_ctx *ctx, long long int threshold);
/**
- * grn_get_default_query_escalation_threshold:
+ * grn_get_default_match_escalation_threshold:
*
- * デフォルトのクエリをエスカレーションする閾値を返します。
+ * デフォルトの検索の挙動をエスカレーションする閾値を返します。
+ * エスカレーションの詳細は検索の仕様に関するドキュメントを参
+ * 照してください。
**/
-GRN_API long long int grn_get_default_query_escalation_threshold(void);
+GRN_API long long int grn_get_default_match_escalation_threshold(void);
/**
- * grn_set_default_query_escalation_threshold:
- * @threshold: 変更後のデフォルトのクエリをエスカレーションする閾値を指定します。
+ * grn_set_default_match_escalation_threshold:
+ * @threshold: 変更後のデフォルトの検索の挙動をエスカレーションする閾値を指定します。
*
- * デフォルトのクエリをエスカレーションする閾値を変更します。
+ * デフォルトの検索の挙動をエスカレーションする閾値を変更しま
+ * す。エスカレーションの詳細は詳細は検索の仕様に関するドキュ
+ * メントを参照してください。
**/
-GRN_API grn_rc grn_set_default_query_escalation_threshold(long long int threshold);
+GRN_API grn_rc grn_set_default_match_escalation_threshold(long long int threshold);
/* obj */
Modified: lib/ctx.c (+13 -11)
===================================================================
--- lib/ctx.c 2010-10-21 09:30:37 +0000 (abcbaf0)
+++ lib/ctx.c 2010-10-28 05:15:33 +0000 (58fcaa3)
@@ -286,9 +286,11 @@ grn_ctx_impl_init(grn_ctx *ctx)
}
if (ctx == &grn_gctx) {
- ctx->impl->escalation_threshold = GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD;
+ ctx->impl->match_escalation_threshold =
+ GROONGA_DEFAULT_MATCH_ESCALATION_THRESHOLD;
} else {
- ctx->impl->escalation_threshold = grn_get_default_query_escalation_threshold();
+ ctx->impl->match_escalation_threshold =
+ grn_get_default_match_escalation_threshold();
}
ctx->impl->phs = NIL;
@@ -732,15 +734,15 @@ grn_set_default_command_version(grn_command_version version)
}
long long int
-grn_get_default_query_escalation_threshold(void)
+grn_get_default_match_escalation_threshold(void)
{
- return grn_ctx_get_query_escalation_threshold(&grn_gctx);
+ return grn_ctx_get_match_escalation_threshold(&grn_gctx);
}
grn_rc
-grn_set_default_query_escalation_threshold(long long int threshold)
+grn_set_default_match_escalation_threshold(long long int threshold)
{
- return grn_ctx_set_query_escalation_threshold(&grn_gctx, threshold);
+ return grn_ctx_set_match_escalation_threshold(&grn_gctx, threshold);
}
static int alloc_count = 0;
@@ -826,19 +828,19 @@ grn_ctx_set_command_version(grn_ctx *ctx, grn_command_version version)
}
long long int
-grn_ctx_get_query_escalation_threshold(grn_ctx *ctx)
+grn_ctx_get_match_escalation_threshold(grn_ctx *ctx)
{
if (ctx->impl) {
- return ctx->impl->escalation_threshold;
+ return ctx->impl->match_escalation_threshold;
} else {
- return GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD;
+ return GROONGA_DEFAULT_MATCH_ESCALATION_THRESHOLD;
}
}
grn_rc
-grn_ctx_set_query_escalation_threshold(grn_ctx *ctx, long long int threshold)
+grn_ctx_set_match_escalation_threshold(grn_ctx *ctx, long long int threshold)
{
- ctx->impl->escalation_threshold = threshold;
+ ctx->impl->match_escalation_threshold = threshold;
return GRN_SUCCESS;
}
Modified: lib/expr.c (+1 -1)
===================================================================
--- lib/expr.c 2010-10-21 09:30:37 +0000 (6446cb2)
+++ lib/expr.c 2010-10-28 05:15:33 +0000 (6ee15d9)
@@ -5474,7 +5474,7 @@ grn_expr_parse(grn_ctx *ctx, grn_obj *expr,
GRN_INT32_PUT(ctx, &efsi.op_stack, default_op);
GRN_INT32_PUT(ctx, &efsi.mode_stack, default_mode);
efsi.default_flags = efsi.flags = flags;
- efsi.escalation_threshold = GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD;
+ efsi.escalation_threshold = GROONGA_DEFAULT_MATCH_ESCALATION_THRESHOLD;
efsi.escalation_decaystep = DEFAULT_DECAYSTEP;
efsi.weight_offset = 0;
efsi.opt.weight_vector = NULL;
Modified: lib/ii.c (+2 -2)
===================================================================
--- lib/ii.c 2010-10-21 09:30:37 +0000 (e7f3b5b)
+++ lib/ii.c 2010-10-28 05:15:33 +0000 (67c22fb)
@@ -5941,7 +5941,7 @@ grn_ii_sel(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_len
}
GRN_LOG(ctx, GRN_LOG_INFO, "exact: %d", GRN_HASH_SIZE(s));
if (op == GRN_OP_OR) {
- if ((int64_t)GRN_HASH_SIZE(s) <= ctx->impl->escalation_threshold) {
+ if ((int64_t)GRN_HASH_SIZE(s) <= ctx->impl->match_escalation_threshold) {
arg.mode = GRN_OP_UNSPLIT;
if (grn_ii_select(ctx, ii, string, string_len, s, op, &arg)) {
GRN_LOG(ctx, GRN_LOG_ERROR, "grn_ii_select on grn_ii_sel(2) failed !");
@@ -5949,7 +5949,7 @@ grn_ii_sel(grn_ctx *ctx, grn_ii *ii, const char *string, unsigned int string_len
}
GRN_LOG(ctx, GRN_LOG_INFO, "unsplit: %d", GRN_HASH_SIZE(s));
}
- if ((int64_t)GRN_HASH_SIZE(s) <= ctx->impl->escalation_threshold) {
+ if ((int64_t)GRN_HASH_SIZE(s) <= ctx->impl->match_escalation_threshold) {
arg.mode = GRN_OP_PARTIAL;
if (grn_ii_select(ctx, ii, string, string_len, s, op, &arg)) {
GRN_LOG(ctx, GRN_LOG_ERROR, "grn_ii_select on grn_ii_sel(3) failed !");
Modified: lib/proc.c (+11 -11)
===================================================================
--- lib/proc.c 2010-10-21 09:30:37 +0000 (7b36fb5)
+++ lib/proc.c 2010-10-28 05:15:33 +0000 (ca7c159)
@@ -59,7 +59,7 @@ grn_select(grn_ctx *ctx, const char *table, unsigned table_len,
const char *drilldown_output_columns, unsigned drilldown_output_columns_len,
int drilldown_offset, int drilldown_limit,
const char *cache, unsigned cache_len,
- const char *query_escalation_threshold, unsigned query_escalation_threshold_len)
+ const char *match_escalation_threshold, unsigned match_escalation_threshold_len)
{
uint32_t nkeys, nhits;
uint16_t cacheable = 1, taintable = 0;
@@ -72,7 +72,7 @@ grn_select(grn_ctx *ctx, const char *table, unsigned table_len,
uint32_t cache_key_size = table_len + 1 + match_columns_len + 1 + query_len + 1 +
filter_len + 1 + scorer_len + 1 + sortby_len + 1 + output_columns_len + 1 +
drilldown_len + 1 + drilldown_sortby_len + 1 + drilldown_output_columns_len +
- query_escalation_threshold_len + 1 +
+ match_escalation_threshold_len + 1 +
sizeof(grn_content_type) + sizeof(int) * 4;
long long int threshold, original_threshold;
if (cache_key_size <= GRN_TABLE_MAX_KEY_SIZE) {
@@ -98,8 +98,8 @@ grn_select(grn_ctx *ctx, const char *table, unsigned table_len,
cp += drilldown_sortby_len; *cp++ = '\0';
memcpy(cp, drilldown_output_columns, drilldown_output_columns_len);
cp += drilldown_output_columns_len; *cp++ = '\0';
- memcpy(cp, &query_escalation_threshold, query_escalation_threshold_len);
- cp += query_escalation_threshold_len; *cp++ = '\0';
+ memcpy(cp, &match_escalation_threshold, match_escalation_threshold_len);
+ cp += match_escalation_threshold_len; *cp++ = '\0';
memcpy(cp, &output_type, sizeof(grn_content_type)); cp += sizeof(grn_content_type);
memcpy(cp, &offset, sizeof(int)); cp += sizeof(int);
memcpy(cp, &limit, sizeof(int)); cp += sizeof(int);
@@ -112,13 +112,13 @@ grn_select(grn_ctx *ctx, const char *table, unsigned table_len,
return ctx->rc;
}
}
- if (query_escalation_threshold_len) {
+ if (match_escalation_threshold_len) {
const char *end, *rest;
- original_threshold = grn_ctx_get_query_escalation_threshold(ctx);
- end = query_escalation_threshold + query_escalation_threshold_len;
- threshold = grn_atoll(query_escalation_threshold, end, &rest);
+ original_threshold = grn_ctx_get_match_escalation_threshold(ctx);
+ end = match_escalation_threshold + match_escalation_threshold_len;
+ threshold = grn_atoll(match_escalation_threshold, end, &rest);
if (end == rest) {
- grn_ctx_set_query_escalation_threshold(ctx, threshold);
+ grn_ctx_set_match_escalation_threshold(ctx, threshold);
}
}
if ((table_ = grn_ctx_get(ctx, table, table_len))) {
@@ -296,8 +296,8 @@ grn_select(grn_ctx *ctx, const char *table, unsigned table_len,
} else {
ERR(GRN_INVALID_ARGUMENT, "invalid table name: %.*s", table_len, table);
}
- if (query_escalation_threshold_len) {
- grn_ctx_set_query_escalation_threshold(ctx, original_threshold);
+ if (match_escalation_threshold_len) {
+ grn_ctx_set_match_escalation_threshold(ctx, original_threshold);
}
/* GRN_LOG(ctx, GRN_LOG_NONE, "%d", ctx->seqno); */
return ctx->rc;
Modified: lib/ql.h (+2 -2)
===================================================================
--- lib/ql.h 2010-10-21 09:30:37 +0000 (bfa96cc)
+++ lib/ql.h 2010-10-28 05:15:33 +0000 (a5b2b12)
@@ -221,8 +221,8 @@ struct _grn_ctx_impl {
/* command portion */
grn_command_version command_version;
- /* query escalation portion */
- int64_t escalation_threshold;
+ /* match escalation portion */
+ int64_t match_escalation_threshold;
/* ql portion */
uint32_t ncells;
Modified: lib/query.c (+1 -1)
===================================================================
--- lib/query.c 2010-10-21 09:30:37 +0000 (0a878f3)
+++ lib/query.c 2010-10-28 05:15:33 +0000 (4240982)
@@ -446,7 +446,7 @@ grn_query_open(grn_ctx *ctx, const char *str, unsigned int str_len,
q->max_cells = max_cells;
q->cur_cell = 0;
q->cur_expr = 0;
- q->escalation_threshold = GROONGA_DEFAULT_QUERY_ESCALATION_THRESHOLD;
+ q->escalation_threshold = GROONGA_DEFAULT_MATCH_ESCALATION_THRESHOLD;
q->escalation_decaystep = DEFAULT_DECAYSTEP;
q->weight_offset = 0;
q->opt.weight_vector = NULL;
Modified: src/groonga.c (+13 -13)
===================================================================
--- src/groonga.c 2010-10-21 09:30:37 +0000 (996feb4)
+++ src/groonga.c 2010-10-28 05:15:33 +0000 (c1674ca)
@@ -111,8 +111,8 @@ usage(FILE *output)
" --file <path>: read commands from specified file\n"
" --default-command-version <version>:\n"
" specify default command version\n"
- " --default-query-escalation-threshold <threshold>:\n"
- " specify default query escalation threshold\n"
+ " --default-match-escalation-threshold <threshold>:\n"
+ " specify default match escalation threshold\n"
"\n"
"dest: <db pathname> [<command>] or <dest hostname>\n"
" <db pathname> [<command>]: when standalone/server mode\n"
@@ -137,8 +137,8 @@ show_version(void)
#endif
printf("%s", GROONGA_DEFAULT_ENCODING);
- printf(",query-escalation-threshold=%" GRN_FMT_LLD,
- grn_get_default_query_escalation_threshold());
+ printf(",match-escalation-threshold=%" GRN_FMT_LLD,
+ grn_get_default_match_escalation_threshold());
#ifndef NO_NFKC
printf(",nfkc");
@@ -2066,7 +2066,7 @@ main(int argc, char **argv)
*max_nfthreadsstr = NULL, *loglevel = NULL,
*listen_addressstr = NULL, *hostnamestr = NULL, *protocol = NULL,
*cache_limitstr = NULL, *admin_html_path = NULL, *command_versionstr = NULL,
- *query_escalation_thresholdstr = NULL;
+ *match_escalation_thresholdstr = NULL;
const char *config_path = NULL;
const char *input_path = NULL;
int r, i, mode = mode_alone;
@@ -2095,7 +2095,7 @@ main(int argc, char **argv)
{'\0', "file", NULL, 0, getopt_op_none},
{'\0', "document-root", NULL, 0, getopt_op_none},
{'\0', "default-command-version", NULL, 0, getopt_op_none},
- {'\0', "default-query-escalation-threshold", NULL, 0, getopt_op_none},
+ {'\0', "default-match-escalation-threshold", NULL, 0, getopt_op_none},
{'\0', NULL, NULL, 0, 0}
};
opts[0].arg = &portstr;
@@ -2114,7 +2114,7 @@ main(int argc, char **argv)
opts[21].arg = &input_path;
opts[22].arg = &grn_document_root;
opts[23].arg = &command_versionstr;
- opts[24].arg = &query_escalation_thresholdstr;
+ opts[24].arg = &match_escalation_thresholdstr;
if (!(default_max_nfthreads = get_core_number())) {
default_max_nfthreads = DEFAULT_MAX_NFTHREADS;
}
@@ -2254,17 +2254,17 @@ main(int argc, char **argv)
if (command_versionstr) {
grn_set_default_command_version(atoi(command_versionstr));
}
- if (query_escalation_thresholdstr) {
+ if (match_escalation_thresholdstr) {
int64_t threshold;
const char *end, *rest;
- end = query_escalation_thresholdstr + strlen(query_escalation_thresholdstr);
- threshold = grn_atoll(query_escalation_thresholdstr, end, &rest);
+ end = match_escalation_thresholdstr + strlen(match_escalation_thresholdstr);
+ threshold = grn_atoll(match_escalation_thresholdstr, end, &rest);
if (end != rest) {
- fprintf(stderr, "invalid default query escalation threshold: <%s>\n",
- query_escalation_thresholdstr);
+ fprintf(stderr, "invalid default match escalation threshold: <%s>\n",
+ match_escalation_thresholdstr);
return EXIT_FAILURE;
}
- grn_set_default_query_escalation_threshold(threshold);
+ grn_set_default_match_escalation_threshold(threshold);
}
if (loglevel) { SET_LOGLEVEL(atoi(loglevel)); }
grn_set_segv_handler();