mirror of
https://github.com/MariaDB/server.git
synced 2025-11-12 10:22:39 +03:00
Merge work:/home/bk/mysql-4.0
into serg.mysql.com:/usr/home/serg/Abk/mysql-4.0
This commit is contained in:
@@ -79,6 +79,8 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
|||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
DBUG_ENTER("walk_and_match");
|
||||||
|
|
||||||
word->weight=LWS_FOR_QUERY;
|
word->weight=LWS_FOR_QUERY;
|
||||||
|
|
||||||
keylen=_ft_make_key(aio->info,aio->keynr,(char*) aio->keybuff,word,0);
|
keylen=_ft_make_key(aio->info,aio->keynr,(char*) aio->keybuff,word,0);
|
||||||
@@ -111,7 +113,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
|||||||
#else
|
#else
|
||||||
#error
|
#error
|
||||||
#endif
|
#endif
|
||||||
if(tmp_weight==0) return doc_cnt; /* stopword, doc_cnt should be 0 */
|
if(tmp_weight==0) DBUG_RETURN(doc_cnt); /* stopword, doc_cnt should be 0 */
|
||||||
|
|
||||||
#ifdef EVAL_RUN
|
#ifdef EVAL_RUN
|
||||||
cnt=*(byte *)(aio->info->lastkey+keylen);
|
cnt=*(byte *)(aio->info->lastkey+keylen);
|
||||||
@@ -121,7 +123,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
|||||||
|
|
||||||
/* saving document matched into dtree */
|
/* saving document matched into dtree */
|
||||||
if (!(selem=tree_insert(&aio->dtree, &sdoc, 0)))
|
if (!(selem=tree_insert(&aio->dtree, &sdoc, 0)))
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
|
|
||||||
sptr=(FT_SUPERDOC *)ELEMENT_KEY((&aio->dtree), selem);
|
sptr=(FT_SUPERDOC *)ELEMENT_KEY((&aio->dtree), selem);
|
||||||
|
|
||||||
@@ -152,21 +154,22 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
|
|||||||
if (doc_cnt)
|
if (doc_cnt)
|
||||||
{
|
{
|
||||||
word->weight*=GWS_IN_USE;
|
word->weight*=GWS_IN_USE;
|
||||||
if (word->weight < 0)
|
if (word->weight < 0) word->weight=0;
|
||||||
word->weight=0;
|
|
||||||
}
|
}
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int walk_and_copy(FT_SUPERDOC *from,
|
static int walk_and_copy(FT_SUPERDOC *from,
|
||||||
uint32 count __attribute__((unused)), FT_DOC **to)
|
uint32 count __attribute__((unused)), FT_DOC **to)
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("walk_and_copy");
|
||||||
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
|
from->doc.weight+=from->tmp_weight*from->word_ptr->weight;
|
||||||
(*to)->dpos=from->doc.dpos;
|
(*to)->dpos=from->doc.dpos;
|
||||||
(*to)->weight=from->doc.weight;
|
(*to)->weight=from->doc.weight;
|
||||||
(*to)++;
|
(*to)++;
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -184,12 +187,13 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
|
|||||||
FT_DOC *dptr;
|
FT_DOC *dptr;
|
||||||
FT_INFO *dlist=NULL;
|
FT_INFO *dlist=NULL;
|
||||||
my_off_t saved_lastpos=info->lastpos;
|
my_off_t saved_lastpos=info->lastpos;
|
||||||
|
DBUG_ENTER("ft_init_nlq_search");
|
||||||
|
|
||||||
/* black magic ON */
|
/* black magic ON */
|
||||||
if ((int) (keynr = _mi_check_index(info,keynr)) < 0)
|
if ((int) (keynr = _mi_check_index(info,keynr)) < 0)
|
||||||
return NULL;
|
DBUG_RETURN(NULL);
|
||||||
if (_mi_readinfo(info,F_RDLCK,1))
|
if (_mi_readinfo(info,F_RDLCK,1))
|
||||||
return NULL;
|
DBUG_RETURN(NULL);
|
||||||
/* black magic OFF */
|
/* black magic OFF */
|
||||||
|
|
||||||
aio.info=info;
|
aio.info=info;
|
||||||
@@ -236,7 +240,7 @@ err2:
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
info->lastpos=saved_lastpos;
|
info->lastpos=saved_lastpos;
|
||||||
return dlist;
|
DBUG_RETURN(dlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ byte ft_simple_get_word(byte **start, byte *end, FT_WORD *word)
|
|||||||
{
|
{
|
||||||
byte *doc=*start;
|
byte *doc=*start;
|
||||||
int mwc;
|
int mwc;
|
||||||
|
DBUG_ENTER("ft_simple_get_word");
|
||||||
|
|
||||||
while (doc<end)
|
while (doc<end)
|
||||||
{
|
{
|
||||||
@@ -207,32 +208,35 @@ byte ft_simple_get_word(byte **start, byte *end, FT_WORD *word)
|
|||||||
!is_stopword(word->pos, word->len))
|
!is_stopword(word->pos, word->len))
|
||||||
{
|
{
|
||||||
*start=doc;
|
*start=doc;
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ft_parse_init(TREE *wtree, CHARSET_INFO *cs)
|
void ft_parse_init(TREE *wtree, CHARSET_INFO *cs)
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("ft_parse_init");
|
||||||
if (!is_tree_inited(wtree))
|
if (!is_tree_inited(wtree))
|
||||||
init_tree(wtree,0,0,sizeof(FT_WORD),(qsort_cmp2)&FT_WORD_cmp,0,NULL, cs);
|
init_tree(wtree,0,0,sizeof(FT_WORD),(qsort_cmp2)&FT_WORD_cmp,0,NULL, cs);
|
||||||
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_parse(TREE *wtree, byte *doc, int doclen)
|
int ft_parse(TREE *wtree, byte *doc, int doclen)
|
||||||
{
|
{
|
||||||
byte *end=doc+doclen;
|
byte *end=doc+doclen;
|
||||||
FT_WORD w;
|
FT_WORD w;
|
||||||
|
DBUG_ENTER("ft_parse");
|
||||||
|
|
||||||
while (ft_simple_get_word(&doc,end,&w))
|
while (ft_simple_get_word(&doc,end,&w))
|
||||||
{
|
{
|
||||||
if (!tree_insert(wtree, &w, 0))
|
if (!tree_insert(wtree, &w, 0))
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
delete_tree(wtree);
|
delete_tree(wtree);
|
||||||
return 1;
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ extern ulong collstat;
|
|||||||
/* Mysterious, but w/o (double) GWS_IDF performs better :-o */
|
/* Mysterious, but w/o (double) GWS_IDF performs better :-o */
|
||||||
#define GWS_IDF log(aio->info->state->records/doc_cnt)
|
#define GWS_IDF log(aio->info->state->records/doc_cnt)
|
||||||
#define GWS_IDF1 log((double)aio->info->state->records/doc_cnt)
|
#define GWS_IDF1 log((double)aio->info->state->records/doc_cnt)
|
||||||
#define GWS_PROB log(((double)(aio->info->state->records-doc_cnt))/doc_cnt)
|
#define GWS_PROB ((aio->info->state->records > doc_cnt) ? log(((double)(aio->info->state->records-doc_cnt))/doc_cnt) : 0 )
|
||||||
#define GWS_FREQ (1.0/doc_cnt)
|
#define GWS_FREQ (1.0/doc_cnt)
|
||||||
#define GWS_SQUARED pow(log((double)aio->info->state->records/doc_cnt),2)
|
#define GWS_SQUARED pow(log((double)aio->info->state->records/doc_cnt),2)
|
||||||
#define GWS_CUBIC pow(log((double)aio->info->state->records/doc_cnt),3)
|
#define GWS_CUBIC pow(log((double)aio->info->state->records/doc_cnt),3)
|
||||||
|
|||||||
@@ -2104,8 +2104,9 @@ err:
|
|||||||
|
|
||||||
void Item_func_match::init_search(bool no_order)
|
void Item_func_match::init_search(bool no_order)
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("Item_func_match::init_search");
|
||||||
if (ft_handler)
|
if (ft_handler)
|
||||||
return;
|
DBUG_VOID_RETURN;
|
||||||
|
|
||||||
if (key == NO_SUCH_KEY)
|
if (key == NO_SUCH_KEY)
|
||||||
concat= new Item_func_concat_ws(new Item_string(" ",1), fields);
|
concat= new Item_func_concat_ws(new Item_string(" ",1), fields);
|
||||||
@@ -2116,7 +2117,7 @@ void Item_func_match::init_search(bool no_order)
|
|||||||
master->init_search(no_order);
|
master->init_search(no_order);
|
||||||
ft_handler=master->ft_handler;
|
ft_handler=master->ft_handler;
|
||||||
join_key=master->join_key;
|
join_key=master->join_key;
|
||||||
return;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
String *ft_tmp=0;
|
String *ft_tmp=0;
|
||||||
@@ -2136,10 +2137,9 @@ void Item_func_match::init_search(bool no_order)
|
|||||||
join_key && !no_order);
|
join_key && !no_order);
|
||||||
|
|
||||||
if (join_key)
|
if (join_key)
|
||||||
{
|
|
||||||
table->file->ft_handler=ft_handler;
|
table->file->ft_handler=ft_handler;
|
||||||
return;
|
|
||||||
}
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2289,13 +2289,14 @@ bool Item_func_match::eq(const Item *item, bool binary_cmp) const
|
|||||||
|
|
||||||
double Item_func_match::val()
|
double Item_func_match::val()
|
||||||
{
|
{
|
||||||
|
DBUG_ENTER("Item_func_match::val");
|
||||||
if (ft_handler == NULL)
|
if (ft_handler == NULL)
|
||||||
return -1.0;
|
DBUG_RETURN(-1.0);
|
||||||
|
|
||||||
if (join_key)
|
if (join_key)
|
||||||
{
|
{
|
||||||
if (table->file->ft_handler)
|
if (table->file->ft_handler)
|
||||||
return ft_handler->please->get_relevance(ft_handler);
|
DBUG_RETURN(ft_handler->please->get_relevance(ft_handler));
|
||||||
join_key=0;
|
join_key=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2303,12 +2304,12 @@ double Item_func_match::val()
|
|||||||
{
|
{
|
||||||
String *a= concat->val_str(&value);
|
String *a= concat->val_str(&value);
|
||||||
if ((null_value= (a == 0)))
|
if ((null_value= (a == 0)))
|
||||||
return 0;
|
DBUG_RETURN(0);
|
||||||
return ft_handler->please->find_relevance(ft_handler,
|
DBUG_RETURN(ft_handler->please->find_relevance(ft_handler,
|
||||||
(byte *)a->ptr(), a->length());
|
(byte *)a->ptr(), a->length()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return ft_handler->please->find_relevance(ft_handler, record, 0);
|
DBUG_RETURN(ft_handler->please->find_relevance(ft_handler, record, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
longlong Item_func_bit_xor::val_int()
|
longlong Item_func_bit_xor::val_int()
|
||||||
|
|||||||
Reference in New Issue
Block a user