MySQL Forums
Forum List  »  Full-Text Search

Re: MySQL crash with custom parser
Posted by: Clement Ho
Date: September 12, 2007 11:33AM

Here is the custom parser code that I wrote. There are only 2 function that I modified from the example.
void add_word(MYSQL_FTPARSER_PARAM *param, char *word, size_t len)
{
MYSQL_FTPARSER_BOOLEAN_INFO bool_info;

bool_info.type=FT_TOKEN_WORD;
bool_info.weight_adjust= 0;
bool_info.wasign =0;
bool_info.trunc = 0;
bool_info.prev = ' ';
bool_info.quot = 0;
if (param->mode == MYSQL_FTPARSER_FULL_BOOLEAN_INFO){
// it is a boolean search
if(*word == '+'){
// And
bool_info.yesno = 1;
word = word + 1;
len = len -1;
}else if(*word == '-'){
// NOT
bool_info.yesno = -1;
word = word + 1;
len = len -1;
}else{
// OR
bool_info.yesno = 0;
}
}else{
bool_info.yesno = 0;
}


param->mysql_add_word(param, word, len, &bool_info);
}
int simple_parser_parse(MYSQL_FTPARSER_PARAM *param)
{
char *end, *start, *docend= param->doc + param->length;

number_of_calls++;

for (end= start= param->doc;; end++)
{
if (end == docend)
{
if (end > start)
add_word(param, start, end - start);
break;
}
else if (*end == ',')
{
if (end > start)
add_word(param, start, end - start);
start= end + 1;
}
}
return(0);
}

Options: ReplyQuote


Subject
Views
Written By
Posted
4025
August 29, 2007 05:51PM
Re: MySQL crash with custom parser
3122
September 12, 2007 11:33AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.