Commit 392315df authored by serg@serg.mysql.com's avatar serg@serg.mysql.com

I have to commit to be able to pull

parent c4229a8d
...@@ -32,7 +32,7 @@ extern "C" { ...@@ -32,7 +32,7 @@ extern "C" {
typedef struct st_ft_info FT_INFO; typedef struct st_ft_info FT_INFO;
struct _ft_vft { struct _ft_vft {
int (*read_next)(FT_INFO *, char *); int (*read_next)(FT_INFO *, char *);
float (*find_relevance)(FT_INFO *, my_off_t); float (*find_relevance)(FT_INFO *, my_off_t, byte *);
void (*close_search)(FT_INFO *); void (*close_search)(FT_INFO *);
float (*get_relevance)(FT_INFO *); float (*get_relevance)(FT_INFO *);
my_off_t (*get_docid)(FT_INFO *); my_off_t (*get_docid)(FT_INFO *);
......
...@@ -321,9 +321,9 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record) ...@@ -321,9 +321,9 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
return my_errno=HA_ERR_END_OF_FILE; return my_errno=HA_ERR_END_OF_FILE;
} }
float ft_boolean_find_relevance(FT_INFO *ftb, my_off_t docid) float ft_boolean_find_relevance(FT_INFO *ftb,
my_off_t docid __attribute__((unused)), byte *record)
{ {
fprintf(stderr, "ft_boolean_find_relevance called!\n");
return -1.0; /* to be done via str scan */ return -1.0; /* to be done via str scan */
} }
......
...@@ -247,7 +247,8 @@ int ft_nlq_read_next(FT_INFO *handler, char *record) ...@@ -247,7 +247,8 @@ int ft_nlq_read_next(FT_INFO *handler, char *record)
return my_errno; return my_errno;
} }
float ft_nlq_find_relevance(FT_INFO *handler, my_off_t docid) float ft_nlq_find_relevance(FT_INFO *handler, my_off_t docid,
byte *record __attribute__((unused)))
{ {
int a,b,c; int a,b,c;
FT_DOC *docs=handler->doc; FT_DOC *docs=handler->doc;
......
...@@ -126,7 +126,7 @@ FT_WORD * _mi_ft_parserecord(MI_INFO *, uint , byte *, const byte *); ...@@ -126,7 +126,7 @@ FT_WORD * _mi_ft_parserecord(MI_INFO *, uint , byte *, const byte *);
const struct _ft_vft _ft_vft_nlq; const struct _ft_vft _ft_vft_nlq;
FT_INFO *ft_init_nlq_search(MI_INFO *, uint, byte *, uint, my_bool); FT_INFO *ft_init_nlq_search(MI_INFO *, uint, byte *, uint, my_bool);
int ft_nlq_read_next(FT_INFO *, char *); int ft_nlq_read_next(FT_INFO *, char *);
float ft_nlq_find_relevance(FT_INFO *, my_off_t ); float ft_nlq_find_relevance(FT_INFO *, my_off_t, byte *);
void ft_nlq_close_search(FT_INFO *); void ft_nlq_close_search(FT_INFO *);
float ft_nlq_get_relevance(FT_INFO *); float ft_nlq_get_relevance(FT_INFO *);
my_off_t ft_nlq_get_docid(FT_INFO *); my_off_t ft_nlq_get_docid(FT_INFO *);
...@@ -135,7 +135,7 @@ void ft_nlq_reinit_search(FT_INFO *); ...@@ -135,7 +135,7 @@ void ft_nlq_reinit_search(FT_INFO *);
const struct _ft_vft _ft_vft_boolean; const struct _ft_vft _ft_vft_boolean;
FT_INFO *ft_init_boolean_search(MI_INFO *, uint, byte *, uint, my_bool); FT_INFO *ft_init_boolean_search(MI_INFO *, uint, byte *, uint, my_bool);
int ft_boolean_read_next(FT_INFO *, char *); int ft_boolean_read_next(FT_INFO *, char *);
float ft_boolean_find_relevance(FT_INFO *, my_off_t ); float ft_boolean_find_relevance(FT_INFO *, my_off_t, byte *);
void ft_boolean_close_search(FT_INFO *); void ft_boolean_close_search(FT_INFO *);
float ft_boolean_get_relevance(FT_INFO *); float ft_boolean_get_relevance(FT_INFO *);
my_off_t ft_boolean_get_docid(FT_INFO *); my_off_t ft_boolean_get_docid(FT_INFO *);
......
...@@ -2065,6 +2065,7 @@ bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist) ...@@ -2065,6 +2065,7 @@ bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist)
} }
const_item_cache=0; const_item_cache=0;
table=((Item_field *)fields.head())->field->table; table=((Item_field *)fields.head())->field->table;
record=table->record[0];
return 0; return 0;
} }
...@@ -2160,7 +2161,6 @@ bool Item_func_match::eq(const Item *item) const ...@@ -2160,7 +2161,6 @@ bool Item_func_match::eq(const Item *item) const
return 0; return 0;
} }
#if 0
double Item_func_match::val() double Item_func_match::val()
{ {
if (ft_handler==NULL) if (ft_handler==NULL)
...@@ -2182,10 +2182,10 @@ double Item_func_match::val() ...@@ -2182,10 +2182,10 @@ double Item_func_match::val()
if ((null_value=(docid==HA_OFFSET_ERROR))) if ((null_value=(docid==HA_OFFSET_ERROR)))
return 0.0; return 0.0;
else else
return ft_handler->please->find_relevance(ft_handler, docid); return ft_handler->please->find_relevance(ft_handler, docid, record);
} }
#endif
#if 0
double Item_func_match_nl::val() double Item_func_match_nl::val()
{ {
if (ft_handler==NULL) if (ft_handler==NULL)
...@@ -2207,7 +2207,7 @@ double Item_func_match_nl::val() ...@@ -2207,7 +2207,7 @@ double Item_func_match_nl::val()
if ((null_value=(docid==HA_OFFSET_ERROR))) if ((null_value=(docid==HA_OFFSET_ERROR)))
return 0.0; return 0.0;
else else
return ft_handler->please->find_relevance(ft_handler, docid); return ft_handler->please->find_relevance(ft_handler, docid, record);
} }
double Item_func_match_bool::val() double Item_func_match_bool::val()
...@@ -2226,9 +2226,11 @@ double Item_func_match_bool::val() ...@@ -2226,9 +2226,11 @@ double Item_func_match_bool::val()
join_key=0; join_key=0;
} }
null_value=1; return ft_handler->please->find_relevance(ft_handler, docid, record);
return -1.0; //null_value=1;
//return -1.0;
} }
#endif
/*************************************************************************** /***************************************************************************
System variables System variables
......
...@@ -867,9 +867,10 @@ class Item_func_match :public Item_real_func ...@@ -867,9 +867,10 @@ class Item_func_match :public Item_real_func
bool join_key; bool join_key;
Item_func_match *master; Item_func_match *master;
FT_INFO * ft_handler; FT_INFO * ft_handler;
byte *record;
Item_func_match(List<Item> &a, Item *b): Item_real_func(b), Item_func_match(List<Item> &a, Item *b): Item_real_func(b),
fields(a), table(0), join_key(0), master(0), ft_handler(0) {} fields(a), table(0), join_key(0), master(0), ft_handler(0) {}
~Item_func_match() ~Item_func_match()
{ {
if (!master && ft_handler) if (!master && ft_handler)
...@@ -886,6 +887,7 @@ class Item_func_match :public Item_real_func ...@@ -886,6 +887,7 @@ class Item_func_match :public Item_real_func
bool fix_fields(THD *thd,struct st_table_list *tlist); bool fix_fields(THD *thd,struct st_table_list *tlist);
bool eq(const Item *) const; bool eq(const Item *) const;
longlong val_int() { return val()!=0.0; } longlong val_int() { return val()!=0.0; }
double val();
bool fix_index(); bool fix_index();
void init_search(bool no_order); void init_search(bool no_order);
...@@ -896,7 +898,7 @@ class Item_func_match_nl :public Item_func_match ...@@ -896,7 +898,7 @@ class Item_func_match_nl :public Item_func_match
public: public:
Item_func_match_nl(List<Item> &a, Item *b): Item_func_match(a,b) {} Item_func_match_nl(List<Item> &a, Item *b): Item_func_match(a,b) {}
const char *func_name() const { return "match_nl"; } const char *func_name() const { return "match_nl"; }
double val(); // double val();
int ft_handler_init(const byte *query, uint querylen, bool presort) int ft_handler_init(const byte *query, uint querylen, bool presort)
{ ft_handler=table->file->ft_init_ext(FT_NL,key, query, querylen, presort); } { ft_handler=table->file->ft_init_ext(FT_NL,key, query, querylen, presort); }
}; };
...@@ -906,7 +908,7 @@ class Item_func_match_bool :public Item_func_match ...@@ -906,7 +908,7 @@ class Item_func_match_bool :public Item_func_match
public: public:
Item_func_match_bool(List<Item> &a, Item *b): Item_func_match(a,b) {} Item_func_match_bool(List<Item> &a, Item *b): Item_func_match(a,b) {}
const char *func_name() const { return "match_bool"; } const char *func_name() const { return "match_bool"; }
double val(); // double val();
int ft_handler_init(const byte *query, uint querylen, bool presort) int ft_handler_init(const byte *query, uint querylen, bool presort)
{ ft_handler=table->file->ft_init_ext(FT_BOOL,key, query, querylen, presort); } { ft_handler=table->file->ft_init_ext(FT_BOOL,key, query, querylen, presort); }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment