diff options
author | unknown <serg@serg.mysql.com> | 2001-11-28 18:01:50 +0100 |
---|---|---|
committer | unknown <serg@serg.mysql.com> | 2001-11-28 18:01:50 +0100 |
commit | 6752d4820ab4224a8b612e32064aa87c3736c397 (patch) | |
tree | 0ab79a595aa567c880823477d9a52a1b59b1d1ca /myisam | |
parent | 270f00eeade4b4092e9cf040e3f53c866cfbf39c (diff) | |
parent | 1c9d0d0655c8bff68ee1623bdd7af6ae648b1b36 (diff) | |
download | mariadb-git-6752d4820ab4224a8b612e32064aa87c3736c397.tar.gz |
Merge
sql/sql_select.cc:
Auto merged
Docs/manual.texi:
SCCS merged
Diffstat (limited to 'myisam')
-rw-r--r-- | myisam/ft_boolean_search.c | 22 | ||||
-rw-r--r-- | myisam/ft_dump.c | 12 | ||||
-rw-r--r-- | myisam/ft_nlq_search.c | 12 | ||||
-rw-r--r-- | myisam/ft_parser.c | 6 | ||||
-rw-r--r-- | myisam/ft_update.c | 6 | ||||
-rw-r--r-- | myisam/ftdefs.h | 6 |
6 files changed, 42 insertions, 22 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c index 70ba7fc9df2..0055842c24b 100644 --- a/myisam/ft_boolean_search.c +++ b/myisam/ft_boolean_search.c @@ -152,13 +152,16 @@ void _ftb_init_index_search(FT_INFO *ftb) int i, r; FTB_WORD *ftbw; MI_INFO *info=ftb->info; - MI_KEYDEF *keyinfo=info->s->keyinfo+ftb->keynr; - my_off_t keyroot=info->s->state.key_root[ftb->keynr]; + MI_KEYDEF *keyinfo; + my_off_t keyroot; - if (ftb->state != READY) + if (ftb->state != READY || ftb->keynr == NO_SUCH_KEY) return; ftb->state=INDEX_SEARCH; + keyinfo=info->s->keyinfo+ftb->keynr; + keyroot=info->s->state.key_root[ftb->keynr]; + for (i=ftb->queue.elements; i; i--) { ftbw=(FTB_WORD *)(ftb->queue.root[i]); @@ -352,14 +355,17 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) return my_errno=HA_ERR_END_OF_FILE; } -float ft_boolean_find_relevance(FT_INFO *ftb, my_off_t docid, byte *record) +float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length) { TREE ptree; FT_WORD word; FTB_WORD *ftbw; FTB_EXPR *ftbe; uint i; + my_off_t docid=ftb->info->lastpos; + if (docid == HA_POS_ERROR) + return -2.0; if (ftb->state == READY || ftb->state == INDEX_DONE) { for (i=1; i<=ftb->queue.elements; i++) @@ -382,11 +388,13 @@ float ft_boolean_find_relevance(FT_INFO *ftb, my_off_t docid, byte *record) ftb->state=SCAN; } else if (ftb->state != SCAN) - return -2.0; + return -3.0; bzero(&ptree, sizeof(ptree)); - if (_mi_ft_parse(& ptree, ftb->info, ftb->keynr, record)) - return -3.0; + if ((ftb->keynr==NO_SUCH_KEY) + ? ft_parse(& ptree, record, length) + : _mi_ft_parse(& ptree, ftb->info, ftb->keynr, record)) + return -4.0; for (i=1; i<=ftb->queue.elements; i++) { diff --git a/myisam/ft_dump.c b/myisam/ft_dump.c index 2c85669ff0e..940164f89c5 100644 --- a/myisam/ft_dump.c +++ b/myisam/ft_dump.c @@ -159,7 +159,7 @@ err: return 0; } -const char *options="dscve:h"; +const char *options="dscvh"; static void get_options(int argc, char *argv[]) { @@ -184,7 +184,15 @@ static void get_options(int argc, char *argv[]) static void usage(char *argv[]) { - printf("Use: %s [-%s] <table_name> <key_no>\n", *argv, options); + printf(" +Use: %s [-%s] <table_name> <index_no> + +-d dump index (incl. data offsets and word weights) +-s report global stats +-c calculate per-word stats (counts and global weights) +-v be verbose +-h this text\n +", *argv, options); exit(1); } diff --git a/myisam/ft_nlq_search.c b/myisam/ft_nlq_search.c index 2a55ff839ca..5bb2ffab939 100644 --- a/myisam/ft_nlq_search.c +++ b/myisam/ft_nlq_search.c @@ -169,7 +169,7 @@ static int FT_DOC_cmp(FT_DOC *a, FT_DOC *b) FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, uint query_len, my_bool presort) { - TREE *wtree, allocated_wtree; + TREE allocated_wtree, *wtree=&allocated_wtree; ALL_IN_ONE aio; FT_DOC *dptr; FT_INFO *dlist=NULL; @@ -193,7 +193,7 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query, init_tree(&aio.dtree,0,0,sizeof(FT_SUPERDOC),(qsort_cmp2)&FT_SUPERDOC_cmp,0, NULL, NULL); - if(!(wtree=ft_parse(&allocated_wtree,query,query_len))) + if(ft_parse(&allocated_wtree,query,query_len)) goto err; if(tree_walk(wtree, (tree_walk_action)&walk_and_match, &aio, @@ -247,11 +247,15 @@ int ft_nlq_read_next(FT_INFO *handler, char *record) return my_errno; } -float ft_nlq_find_relevance(FT_INFO *handler, my_off_t docid, - byte *record __attribute__((unused))) +float ft_nlq_find_relevance(FT_INFO *handler, + byte *record __attribute__((unused)), uint length __attribute__((unused))) { int a,b,c; FT_DOC *docs=handler->doc; + my_off_t docid=handler->info->lastpos; + + if (docid == HA_POS_ERROR) + return -5.0; /* Assuming docs[] is sorted by dpos... */ diff --git a/myisam/ft_parser.c b/myisam/ft_parser.c index 35e5959b556..0d1495da548 100644 --- a/myisam/ft_parser.c +++ b/myisam/ft_parser.c @@ -206,7 +206,7 @@ byte ft_simple_get_word(byte **start, byte *end, FT_WORD *word) return 0; } -TREE * ft_parse(TREE *wtree, byte *doc, int doclen) +int ft_parse(TREE *wtree, byte *doc, int doclen) { byte *end=doc+doclen; FT_WORD w; @@ -221,10 +221,10 @@ TREE * ft_parse(TREE *wtree, byte *doc, int doclen) if (!tree_insert(wtree, &w, 0)) goto err; } - return wtree; + return 0; err: delete_tree(wtree); - return NULL; + return 1; } diff --git a/myisam/ft_update.c b/myisam/ft_update.c index 89da06e673f..1bc0ace6c77 100644 --- a/myisam/ft_update.c +++ b/myisam/ft_update.c @@ -28,7 +28,7 @@ /**************************************************************/ -/* parses a document i.e. calls _mi_ft_parse for every keyseg */ +/* parses a document i.e. calls ft_parse for every keyseg */ uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record) { byte *pos; @@ -57,11 +57,11 @@ uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record) } else len=keyseg->length; - if (!(ft_parse(parsed, pos, len))) + if (ft_parse(parsed, pos, len)) return 1; } /* Handle the case where all columns are NULL */ - if (!is_tree_inited(parsed) && !(ft_parse(parsed, (byte*) "", 0))) + if (!is_tree_inited(parsed) && ft_parse(parsed, (byte*) "", 0)) return 1; else return 0; diff --git a/myisam/ftdefs.h b/myisam/ftdefs.h index fd3660edcba..147c3f5b5e6 100644 --- a/myisam/ftdefs.h +++ b/myisam/ftdefs.h @@ -120,14 +120,14 @@ uint _ft_make_key(MI_INFO *, uint , byte *, FT_WORD *, my_off_t); byte ft_get_word(byte **, byte *, FT_WORD *, FTB_PARAM *); byte ft_simple_get_word(byte **, byte *, FT_WORD *); -TREE * ft_parse(TREE *, byte *, int); +int ft_parse(TREE *, byte *, int); FT_WORD * ft_linearize(/*MI_INFO *, uint, byte *, */TREE *); FT_WORD * _mi_ft_parserecord(MI_INFO *, uint, byte *, const byte *); const struct _ft_vft _ft_vft_nlq; FT_INFO *ft_init_nlq_search(MI_INFO *, uint, byte *, uint, my_bool); int ft_nlq_read_next(FT_INFO *, char *); -float ft_nlq_find_relevance(FT_INFO *, my_off_t, byte *); +float ft_nlq_find_relevance(FT_INFO *, byte *, uint); void ft_nlq_close_search(FT_INFO *); float ft_nlq_get_relevance(FT_INFO *); my_off_t ft_nlq_get_docid(FT_INFO *); @@ -136,7 +136,7 @@ void ft_nlq_reinit_search(FT_INFO *); const struct _ft_vft _ft_vft_boolean; FT_INFO *ft_init_boolean_search(MI_INFO *, uint, byte *, uint, my_bool); int ft_boolean_read_next(FT_INFO *, char *); -float ft_boolean_find_relevance(FT_INFO *, my_off_t, byte *); +float ft_boolean_find_relevance(FT_INFO *, byte *, uint); void ft_boolean_close_search(FT_INFO *); float ft_boolean_get_relevance(FT_INFO *); my_off_t ft_boolean_get_docid(FT_INFO *); |