summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-03-09 14:09:06 +0100
committerunknown <serg@serg.mylan>2005-03-09 14:09:06 +0100
commit48577bb59f5ab34bd01fba50cddc6c00ceb65d41 (patch)
tree4625d7f51e27bb495a5f571cfcad95a20d34e4a9 /myisam
parent3b214ab3e82a0de322ebdcbb4175613a3916b5b3 (diff)
parentad019543e601a4d60453efce29603a12ead35fe9 (diff)
downloadmariadb-git-48577bb59f5ab34bd01fba50cddc6c00ceb65d41.tar.gz
merged
BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union Build-tools/Do-compile: Auto merged client/mysql.cc: Auto merged client/mysqldump.c: Auto merged include/my_sys.h: Auto merged innobase/buf/buf0lru.c: Auto merged innobase/dict/dict0dict.c: Auto merged innobase/include/page0page.ic: Auto merged innobase/include/srv0srv.h: Auto merged innobase/os/os0thread.c: Auto merged innobase/rem/rem0cmp.c: Auto merged innobase/row/row0mysql.c: Auto merged innobase/row/row0sel.c: Auto merged innobase/srv/srv0srv.c: Auto merged innobase/trx/trx0sys.c: Auto merged innobase/trx/trx0trx.c: Auto merged innobase/ut/ut0ut.c: Auto merged myisam/ft_parser.c: Auto merged myisam/mi_create.c: Auto merged mysql-test/Makefile.am: Auto merged mysql-test/mysql-test-run.pl: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/mysqldump.result: Auto merged mysql-test/r/ndb_alter_table.result: Auto merged mysql-test/t/mysqldump.test: Auto merged mysql-test/t/ndb_alter_table.test: Auto merged mysys/hash.c: Auto merged mysys/my_bitmap.c: Auto merged ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/make_win_src_distribution.sh: Auto merged sql/net_serv.cc: Auto merged sql/sql_select.cc: Auto merged
Diffstat (limited to 'myisam')
-rw-r--r--myisam/ft_parser.c4
-rw-r--r--myisam/myisam_ftdump.c188
2 files changed, 91 insertions, 101 deletions
diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c
index 3184cc6644c..2fad2363ae2 100644
--- a/myisam/ft_parser.c
+++ b/myisam/ft_parser.c
@@ -105,7 +105,7 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end,
FT_WORD *word, FTB_PARAM *param)
{
byte *doc=*start;
- uint mwc, length;
+ uint mwc, length, mbl;
param->yesno=(FTB_YES==' ') ? 1 : (param->quot != 0);
param->plusminus=param->pmsign=0;
@@ -146,7 +146,7 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end,
}
mwc=length=0;
- for (word->pos=doc; doc<end; length++, doc+=my_mbcharlen(cs, *(uchar *)doc))
+ for (word->pos=doc; doc<end; length++, mbl=my_mbcharlen(cs, *(uchar *)doc), doc+=(mbl ? mbl : 1))
if (true_word_char(cs,*doc))
mwc=0;
else if (!misc_word_char(*doc) || mwc++)
diff --git a/myisam/myisam_ftdump.c b/myisam/myisam_ftdump.c
index 54b2cc77965..28aac0a8ecf 100644
--- a/myisam/myisam_ftdump.c
+++ b/myisam/myisam_ftdump.c
@@ -44,10 +44,6 @@ static struct my_option my_long_options[] =
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"length", 'l', "Report length distribution.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef DISABLED
- {"execute", 'e', "Execute given query.", (gptr*) &query, (gptr*) &query, 0,
- GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-#endif
{"help", 'h', "Display help and exit.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
{"help", '?', "Synonym for -h.",
@@ -108,122 +104,119 @@ int main(int argc,char *argv[])
mi_lock_database(info, F_EXTRA_LCK);
- if (query)
- {
-#if 0
- FT_DOCLIST *result;
- int i;
-
- ft_init_stopwords(ft_precompiled_stopwords);
-
- result=ft_nlq_init_search(info,inx,query,strlen(query),1);
- if(!result)
- goto err;
+ info->lastpos= HA_OFFSET_ERROR;
+ info->update|= HA_STATE_PREV_FOUND;
- if (verbose)
- printf("%d rows matched\n",result->ndocs);
-
- for(i=0 ; i<result->ndocs ; i++)
- printf("%9lx %20.7f\n",(ulong)result->doc[i].dpos,result->doc[i].weight);
-
- ft_nlq_close_search(result);
-#else
- printf("-e option is disabled\n");
-#endif
- }
- else
+ while (!(error=mi_rnext(info,NULL,inx)))
{
- info->lastpos= HA_OFFSET_ERROR;
- info->update|= HA_STATE_PREV_FOUND;
-
- while (!(error=mi_rnext(info,NULL,inx)))
- {
- keylen=*(info->lastkey);
+ keylen=*(info->lastkey);
- subkeys=ft_sintXkorr(info->lastkey+keylen+1);
- if (subkeys >= 0)
- weight=*(float*)&subkeys;
+ subkeys=ft_sintXkorr(info->lastkey+keylen+1);
+ if (subkeys >= 0)
+ weight=*(float*)&subkeys;
#ifdef HAVE_SNPRINTF
- snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
+ snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
#else
- sprintf(buf,"%.*s",(int) keylen,info->lastkey+1);
+ sprintf(buf,"%.*s",(int) keylen,info->lastkey+1);
#endif
- my_casedn_str(default_charset_info,buf);
- total++;
- lengths[keylen]++;
+ my_casedn_str(default_charset_info,buf);
+ total++;
+ lengths[keylen]++;
- if (count || stats)
+ if (count || stats)
+ {
+ doc_cnt++;
+ if (strcmp(buf, buf2))
{
- doc_cnt++;
- if (strcmp(buf, buf2))
+ if (*buf2)
{
- if (*buf2)
+ uniq++;
+ avg_gws+=gws=GWS_IN_USE;
+ if (count)
+ printf("%9u %20.7f %s\n",doc_cnt,gws,buf2);
+ if (maxlen<keylen2)
{
- uniq++;
- avg_gws+=gws=GWS_IN_USE;
- if (count)
- printf("%9u %20.7f %s\n",doc_cnt,gws,buf2);
- if (maxlen<keylen2)
- {
- maxlen=keylen2;
- strmov(buf_maxlen, buf2);
- }
- if (max_doc_cnt < doc_cnt)
- {
- max_doc_cnt=doc_cnt;
- strmov(buf_min_gws, buf2);
- min_gws=gws;
- }
+ maxlen=keylen2;
+ strmov(buf_maxlen, buf2);
+ }
+ if (max_doc_cnt < doc_cnt)
+ {
+ max_doc_cnt=doc_cnt;
+ strmov(buf_min_gws, buf2);
+ min_gws=gws;
}
- strmov(buf2, buf);
- keylen2=keylen;
- doc_cnt=0;
}
+ strmov(buf2, buf);
+ keylen2=keylen;
+ doc_cnt=0;
}
- if (dump)
- {
- if (subkeys>=0)
- printf("%9lx %20.7f %s\n", (long) info->lastpos,weight,buf);
- else
- printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys,buf);
- }
- if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
- printf("%10ld\r",total);
}
- mi_lock_database(info, F_UNLCK);
+ if (dump)
+ {
+ if (subkeys>=0)
+ printf("%9lx %20.7f %s\n", (long) info->lastpos,weight,buf);
+ else
+ printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys,buf);
+ }
+ if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
+ printf("%10ld\r",total);
+ }
+ mi_lock_database(info, F_UNLCK);
- if (stats)
+ if (count || stats)
+ {
+ doc_cnt++;
+ if (*buf2)
{
- count=0;
- for (inx=0;inx<256;inx++)
+ uniq++;
+ avg_gws+=gws=GWS_IN_USE;
+ if (count)
+ printf("%9u %20.7f %s\n",doc_cnt,gws,buf2);
+ if (maxlen<keylen2)
{
- count+=lengths[inx];
- if ((ulong) count >= total/2)
- break;
+ maxlen=keylen2;
+ strmov(buf_maxlen, buf2);
}
- printf("Total rows: %lu\nTotal words: %lu\n"
- "Unique words: %lu\nLongest word: %lu chars (%s)\n"
- "Median length: %u\n"
- "Average global weight: %f\n"
- "Most common word: %lu times, weight: %f (%s)\n",
- (long) info->state->records, total, uniq, maxlen, buf_maxlen,
- inx, avg_gws/uniq, max_doc_cnt, min_gws, buf_min_gws);
- }
- if (lstats)
- {
- count=0;
- for (inx=0; inx<256; inx++)
+ if (max_doc_cnt < doc_cnt)
{
- count+=lengths[inx];
- if (count && lengths[inx])
- printf("%3u: %10lu %5.2f%% %20lu %4.1f%%\n", inx,
- (ulong) lengths[inx],100.0*lengths[inx]/total,(ulong) count,
- 100.0*count/total);
+ max_doc_cnt=doc_cnt;
+ strmov(buf_min_gws, buf2);
+ min_gws=gws;
}
}
}
+ if (stats)
+ {
+ count=0;
+ for (inx=0;inx<256;inx++)
+ {
+ count+=lengths[inx];
+ if ((ulong) count >= total/2)
+ break;
+ }
+ printf("Total rows: %lu\nTotal words: %lu\n"
+ "Unique words: %lu\nLongest word: %lu chars (%s)\n"
+ "Median length: %u\n"
+ "Average global weight: %f\n"
+ "Most common word: %lu times, weight: %f (%s)\n",
+ (long) info->state->records, total, uniq, maxlen, buf_maxlen,
+ inx, avg_gws/uniq, max_doc_cnt, min_gws, buf_min_gws);
+ }
+ if (lstats)
+ {
+ count=0;
+ for (inx=0; inx<256; inx++)
+ {
+ count+=lengths[inx];
+ if (count && lengths[inx])
+ printf("%3u: %10lu %5.2f%% %20lu %4.1f%%\n", inx,
+ (ulong) lengths[inx],100.0*lengths[inx]/total,(ulong) count,
+ 100.0*count/total);
+ }
+ }
+
err:
if (error && error != HA_ERR_END_OF_FILE)
printf("got error %d\n",my_errno);
@@ -254,9 +247,6 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
lstats=1;
complain(query!=0);
break;
- case 'e':
- complain(dump || count || stats);
- break;
case '?':
case 'h':
usage();