summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mysql.com>2001-10-09 14:53:54 +0200
committerunknown <serg@serg.mysql.com>2001-10-09 14:53:54 +0200
commit736e5b0de2281ab75af2cf3d88480aa6db9a18d2 (patch)
treec39107b036ff091f557b03a1f37183735dcddbad /sql/item_func.cc
parent734e2a8bcaa4a5d2de6059f4cdcac8e71bbb5d6d (diff)
downloadmariadb-git-736e5b0de2281ab75af2cf3d88480aa6db9a18d2.tar.gz
Boolean search passes _some_ tests
sql/ha_myisam.cc: One more abstraction layer added (C++ emulated in C :). include/ft_global.h: boolean search code plugged in mysql-test/r/fulltext_cache.result: boolean search code plugged in mysql-test/r/fulltext_left_join.result: boolean search code plugged in mysql-test/r/fulltext_multi.result: boolean search code plugged in mysql-test/r/fulltext_order_by.result: boolean search code plugged in sql/lex.h: IN BOOLEAN MODE syntax myisam/ft_nlq_search.c: boolean search code plugged in myisam/ftdefs.h: boolean search code plugged in sql/ha_myisam.h: boolean search code plugged in sql/handler.h: boolean search code plugged in include/my_base.h: do_not_sort_keyseg feature for MyISAM include/my_global.h: #define comp(a,b) (((a) < (b)) ? -1 : ((a) > (b)) ? 1 : 0) myisam/ft_boolean_search.c: bugfixing myisam/ft_parser.c: cleanup myisam/ft_static.c: do_not_sort_keyseg feature for MyISAM myisam/mi_search.c: do_not_sort_keyseg feature for MyISAM myisam/mi_write.c: cleanup mysql-test/t/fulltext.test: boolean search tests added BitKeeper/etc/ignore: Added myisam/FT1.MYD myisam/FT1.MYI to the ignore list sql/item_func.cc: boolean search sql/item_func.h: boolean search sql/sql_yacc.yy: boolean search
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc109
1 files changed, 69 insertions, 40 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 076194e8b7b..960cadf71e9 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1903,46 +1903,6 @@ err:
return 0;
}
-double Item_func_match_nl::val()
-{
- if (ft_handler==NULL)
- init_search(1);
-
- if ((null_value= (ft_handler==NULL)))
- return 0.0;
-
- if (join_key)
- {
- if (table->file->ft_handler)
- return ft_nlq_get_relevance(ft_handler);
-
- join_key=0; // Magic here ! See ha_myisam::ft_read()
- }
-
- /* we'll have to find ft_relevance manually in ft_handler array */
-
- int a,b,c;
- FT_DOC *docs=((FT_DOCLIST *)ft_handler)->doc;
- my_off_t docid=table->file->row_position();
-
- if ((null_value=(docid==HA_OFFSET_ERROR)))
- return 0.0;
-
- // Assuming docs[] is sorted by dpos...
-
- for (a=0, b=((FT_DOCLIST *)ft_handler)->ndocs, c=(a+b)/2; b-a>1; c=(a+b)/2)
- {
- if (docs[c].dpos > docid)
- b=c;
- else
- a=c;
- }
- if (docs[a].dpos == docid)
- return docs[a].weight;
- else
- return 0.0;
-}
-
void Item_func_match::init_search(bool no_order)
{
if (ft_handler)
@@ -2113,6 +2073,75 @@ bool Item_func_match::eq(const Item *item) const
return 0;
}
+#if 0
+double Item_func_match::val()
+{
+ if (ft_handler==NULL)
+ init_search(1);
+
+ if ((null_value= (ft_handler==NULL)))
+ return 0.0;
+
+ if (join_key)
+ {
+ if (table->file->ft_handler)
+ return ft_handler->please->get_relevance(ft_handler);
+
+ join_key=0;
+ }
+
+ my_off_t docid=table->file->row_position();
+
+ if ((null_value=(docid==HA_OFFSET_ERROR)))
+ return 0.0;
+ else
+ return ft_handler->please->find_relevance(ft_handler, docid);
+}
+#endif
+
+double Item_func_match_nl::val()
+{
+ if (ft_handler==NULL)
+ init_search(1);
+
+ if ((null_value= (ft_handler==NULL)))
+ return 0.0;
+
+ if (join_key)
+ {
+ if (table->file->ft_handler)
+ return ft_handler->please->get_relevance(ft_handler);
+
+ join_key=0;
+ }
+
+ my_off_t docid=table->file->row_position();
+
+ if ((null_value=(docid==HA_OFFSET_ERROR)))
+ return 0.0;
+ else
+ return ft_handler->please->find_relevance(ft_handler, docid);
+}
+
+double Item_func_match_bool::val()
+{
+ if (ft_handler==NULL)
+ init_search(1);
+
+ if ((null_value= (ft_handler==NULL)))
+ return 0.0;
+
+ if (join_key)
+ {
+ if (table->file->ft_handler)
+ return ft_handler->please->get_relevance(ft_handler);
+
+ join_key=0;
+ }
+
+ null_value=1;
+ return -1.0;
+}
/***************************************************************************
System variables