Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
abbb5220
Commit
abbb5220
authored
Oct 22, 2001
by
serg@serg.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql-4.0
into serg.mysql.com:/usr/home/serg/Abk/mysql-4.0
parents
6a301204
392315df
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
73 additions
and
35 deletions
+73
-35
include/ft_global.h
include/ft_global.h
+1
-1
myisam/ft_boolean_search.c
myisam/ft_boolean_search.c
+2
-2
myisam/ft_nlq_search.c
myisam/ft_nlq_search.c
+2
-1
myisam/ft_update.c
myisam/ft_update.c
+11
-17
myisam/ftdefs.h
myisam/ftdefs.h
+2
-2
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+7
-3
mysql-test/r/fulltext.result
mysql-test/r/fulltext.result
+16
-0
mysql-test/t/fulltext.test
mysql-test/t/fulltext.test
+19
-0
sql/item_func.cc
sql/item_func.cc
+8
-6
sql/item_func.h
sql/item_func.h
+5
-3
No files found.
include/ft_global.h
View file @
abbb5220
...
...
@@ -32,7 +32,7 @@ extern "C" {
typedef
struct
st_ft_info
FT_INFO
;
struct
_ft_vft
{
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
*
);
float
(
*
get_relevance
)(
FT_INFO
*
);
my_off_t
(
*
get_docid
)(
FT_INFO
*
);
...
...
myisam/ft_boolean_search.c
View file @
abbb5220
...
...
@@ -321,9 +321,9 @@ 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
)
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 */
}
...
...
myisam/ft_nlq_search.c
View file @
abbb5220
...
...
@@ -247,7 +247,8 @@ 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
)
float
ft_nlq_find_relevance
(
FT_INFO
*
handler
,
my_off_t
docid
,
byte
*
record
__attribute__
((
unused
)))
{
int
a
,
b
,
c
;
FT_DOC
*
docs
=
handler
->
doc
;
...
...
myisam/ft_update.c
View file @
abbb5220
...
...
@@ -164,41 +164,35 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
int
error
=
-
1
;
FT_WORD
*
oldlist
,
*
newlist
,
*
old_word
,
*
new_word
;
uint
key_length
;
int
cmp
;
int
cmp
,
cmp2
;
if
(
!
(
old_word
=
oldlist
=
_mi_ft_parserecord
(
info
,
keynr
,
keybuf
,
oldrec
)))
goto
err0
;
if
(
!
(
new_word
=
newlist
=
_mi_ft_parserecord
(
info
,
keynr
,
keybuf
,
newrec
)))
goto
err1
;
error
=
0
;
while
(
old_word
->
pos
&&
new_word
->
pos
)
{
cmp
=
_mi_compare_text
(
default_charset_info
,
(
uchar
*
)
old_word
->
pos
,
old_word
->
len
,
(
uchar
*
)
new_word
->
pos
,
new_word
->
len
,
0
);
if
(
cmp
==
0
)
cmp
=
sgn
(
old_word
->
weight
-
new_word
->
weight
);
else
cmp
=
sgn
(
cmp
);
cmp2
=
cmp
?
0
:
(
abs
(
old_word
->
weight
-
new_word
->
weight
)
>
1.e-5
);
switch
(
cmp
)
{
case
-
1
:
if
(
cmp
<
0
||
cmp2
)
{
key_length
=
_ft_make_key
(
info
,
keynr
,
keybuf
,
old_word
,
pos
);
if
((
error
=
_mi_ck_delete
(
info
,
keynr
,(
uchar
*
)
keybuf
,
key_length
)))
goto
err2
;
old_word
++
;
break
;
case
0
:
old_word
++
;
new_word
++
;
break
;
case
1
:
}
if
(
cmp
>
0
||
cmp2
)
{
key_length
=
_ft_make_key
(
info
,
keynr
,
keybuf
,
new_word
,
pos
);
if
((
error
=
_mi_ck_write
(
info
,
keynr
,(
uchar
*
)
keybuf
,
key_length
)))
goto
err2
;
new_word
++
;
break
;
}
}
if
(
cmp
<=
0
)
old_word
++
;
if
(
cmp
>=
0
)
new_word
++
;
}
if
(
old_word
->
pos
)
error
=
_mi_ft_erase
(
info
,
keynr
,
keybuf
,
old_word
,
pos
);
...
...
myisam/ftdefs.h
View file @
abbb5220
...
...
@@ -126,7 +126,7 @@ 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
);
float
ft_nlq_find_relevance
(
FT_INFO
*
,
my_off_t
,
byte
*
);
void
ft_nlq_close_search
(
FT_INFO
*
);
float
ft_nlq_get_relevance
(
FT_INFO
*
);
my_off_t
ft_nlq_get_docid
(
FT_INFO
*
);
...
...
@@ -135,7 +135,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
);
float
ft_boolean_find_relevance
(
FT_INFO
*
,
my_off_t
,
byte
*
);
void
ft_boolean_close_search
(
FT_INFO
*
);
float
ft_boolean_get_relevance
(
FT_INFO
*
);
my_off_t
ft_boolean_get_docid
(
FT_INFO
*
);
...
...
mysql-test/mysql-test-run.sh
View file @
abbb5220
...
...
@@ -673,9 +673,13 @@ start_master()
"gdb -x
$GDB_MASTER_INIT
"
$MYSQLD
elif
[
x
$DO_GDB
=
x1
]
then
$ECHO
"set args
$master_args
"
>
$GDB_MASTER_INIT
$ECHO
"b mysql_parse"
>>
$GDB_MASTER_INIT
$ECHO
"r"
>>
$GDB_MASTER_INIT
$CAT
<<
__GDB_MASTER_INIT__
>
$GDB_MASTER_INIT
b mysql_parse
commands 1
dele 1
end
r
$master_args
__GDB_MASTER_INIT__
manager_launch master
$XTERM
-display
$DISPLAY
\
-title
"Master"
-e
gdb
-x
$GDB_MASTER_INIT
$MYSQLD
else
...
...
mysql-test/r/fulltext.result
View file @
abbb5220
...
...
@@ -112,3 +112,19 @@ Can't find FULLTEXT index matching the column list
select * from t2,t3 where MATCH (t2.inhalt,t3.inhalt) AGAINST ('foobar');
Wrong arguments to MATCH
drop table t1,t2,t3;
CREATE TABLE t1 (
id int(11) auto_increment,
title varchar(100) default '',
PRIMARY KEY (id),
KEY ind5 (title),
FULLTEXT KEY FT1 (title)
) TYPE=MyISAM;
insert into t1 (title) values ('this is a test');
update t1 set title='this is A test' where id=1;
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
update t1 set title='this test once revealed a bug' where id=1;
select * from t1;
id title
1 this test once revealed a bug
mysql-test/t/fulltext.test
View file @
abbb5220
...
...
@@ -92,3 +92,22 @@ select * from t2 where MATCH ticket AGAINST ('foobar');
select
*
from
t2
,
t3
where
MATCH
(
t2
.
inhalt
,
t3
.
inhalt
)
AGAINST
(
'foobar'
);
drop
table
t1
,
t2
,
t3
;
#
# two more bugtests
#
CREATE
TABLE
t1
(
id
int
(
11
)
auto_increment
,
title
varchar
(
100
)
default
''
,
PRIMARY
KEY
(
id
),
KEY
ind5
(
title
),
FULLTEXT
KEY
FT1
(
title
)
)
TYPE
=
MyISAM
;
insert
into
t1
(
title
)
values
(
'this is a test'
);
update
t1
set
title
=
'this is A test'
where
id
=
1
;
check
table
t1
;
update
t1
set
title
=
'this test once revealed a bug'
where
id
=
1
;
select
*
from
t1
;
sql/item_func.cc
View file @
abbb5220
...
...
@@ -2065,6 +2065,7 @@ bool Item_func_match::fix_fields(THD *thd,struct st_table_list *tlist)
}
const_item_cache
=
0
;
table
=
((
Item_field
*
)
fields
.
head
())
->
field
->
table
;
record
=
table
->
record
[
0
];
return
0
;
}
...
...
@@ -2160,7 +2161,6 @@ bool Item_func_match::eq(const Item *item) const
return
0
;
}
#if 0
double
Item_func_match
::
val
()
{
if
(
ft_handler
==
NULL
)
...
...
@@ -2182,10 +2182,10 @@ double Item_func_match::val()
if
((
null_value
=
(
docid
==
HA_OFFSET_ERROR
)))
return
0.0
;
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()
{
if (ft_handler==NULL)
...
...
@@ -2207,7 +2207,7 @@ double Item_func_match_nl::val()
if ((null_value=(docid==HA_OFFSET_ERROR)))
return 0.0;
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()
...
...
@@ -2226,9 +2226,11 @@ double Item_func_match_bool::val()
join_key=0;
}
null_value
=
1
;
return
-
1.0
;
return ft_handler->please->find_relevance(ft_handler, docid, record);
//null_value=1;
//return -1.0;
}
#endif
/***************************************************************************
System variables
...
...
sql/item_func.h
View file @
abbb5220
...
...
@@ -867,9 +867,10 @@ class Item_func_match :public Item_real_func
bool
join_key
;
Item_func_match
*
master
;
FT_INFO
*
ft_handler
;
byte
*
record
;
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
()
{
if
(
!
master
&&
ft_handler
)
...
...
@@ -886,6 +887,7 @@ class Item_func_match :public Item_real_func
bool
fix_fields
(
THD
*
thd
,
struct
st_table_list
*
tlist
);
bool
eq
(
const
Item
*
)
const
;
longlong
val_int
()
{
return
val
()
!=
0.0
;
}
double
val
();
bool
fix_index
();
void
init_search
(
bool
no_order
);
...
...
@@ -896,7 +898,7 @@ class Item_func_match_nl :public Item_func_match
public:
Item_func_match_nl
(
List
<
Item
>
&
a
,
Item
*
b
)
:
Item_func_match
(
a
,
b
)
{}
const
char
*
func_name
()
const
{
return
"match_nl"
;
}
double
val
();
//
double val();
int
ft_handler_init
(
const
byte
*
query
,
uint
querylen
,
bool
presort
)
{
ft_handler
=
table
->
file
->
ft_init_ext
(
FT_NL
,
key
,
query
,
querylen
,
presort
);
...
...
@@ -909,7 +911,7 @@ class Item_func_match_bool :public Item_func_match
public:
Item_func_match_bool
(
List
<
Item
>
&
a
,
Item
*
b
)
:
Item_func_match
(
a
,
b
)
{}
const
char
*
func_name
()
const
{
return
"match_bool"
;
}
double
val
();
//
double val();
int
ft_handler_init
(
const
byte
*
query
,
uint
querylen
,
bool
presort
)
{
ft_handler
=
table
->
file
->
ft_init_ext
(
FT_BOOL
,
key
,
query
,
querylen
,
presort
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment