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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
05f1e100
Commit
05f1e100
authored
Nov 23, 2003
by
monty@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
merge with 4.0
parents
7c725b24
5443cba3
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
19 deletions
+70
-19
myisam/ft_boolean_search.c
myisam/ft_boolean_search.c
+32
-19
mysql-test/r/fulltext.result
mysql-test/r/fulltext.result
+17
-0
mysql-test/r/fulltext_left_join.result
mysql-test/r/fulltext_left_join.result
+8
-0
mysql-test/t/fulltext.test
mysql-test/t/fulltext.test
+11
-0
mysql-test/t/fulltext_left_join.test
mysql-test/t/fulltext_left_join.test
+2
-0
No files found.
myisam/ft_boolean_search.c
View file @
05f1e100
...
@@ -61,10 +61,11 @@ typedef struct st_ftb_expr FTB_EXPR;
...
@@ -61,10 +61,11 @@ typedef struct st_ftb_expr FTB_EXPR;
struct
st_ftb_expr
struct
st_ftb_expr
{
{
FTB_EXPR
*
up
;
FTB_EXPR
*
up
;
byte
*
quot
,
*
qend
;
my_off_t
docid
[
2
]
;
my_off_t
docid
[
2
];
/* for index search and for sca
n */
/* ^^^^^^^^^^^^^^^^^^ FTB_{EXPR,WORD} common sectio
n */
float
weight
;
float
weight
;
float
cur_weight
;
float
cur_weight
;
byte
*
quot
,
*
qend
;
uint
flags
;
uint
flags
;
uint
yesses
;
/* number of "yes" words matched */
uint
yesses
;
/* number of "yes" words matched */
uint
nos
;
/* number of "no" words matched */
uint
nos
;
/* number of "no" words matched */
...
@@ -77,6 +78,7 @@ typedef struct st_ftb_word
...
@@ -77,6 +78,7 @@ typedef struct st_ftb_word
FTB_EXPR
*
up
;
FTB_EXPR
*
up
;
MI_KEYDEF
*
keyinfo
;
MI_KEYDEF
*
keyinfo
;
my_off_t
docid
[
2
];
/* for index search and for scan */
my_off_t
docid
[
2
];
/* for index search and for scan */
/* ^^^^^^^^^^^^^^^^^^ FTB_{EXPR,WORD} common section */
my_off_t
key_root
;
my_off_t
key_root
;
float
weight
;
float
weight
;
uint
ndepth
;
uint
ndepth
;
...
@@ -299,13 +301,15 @@ static void _ftb_init_index_search(FT_INFO *ftb)
...
@@ -299,13 +301,15 @@ static void _ftb_init_index_search(FT_INFO *ftb)
if
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
)
if
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
)
{
{
/*
/*
special treatment for truncation operator
:((
special treatment for truncation operator
1.
+trunc* and there're other (not +trunc*)
words
1.
there are some (besides this) +
words
| no need to search in the index, it can never ADD new rows
| no need to search in the index, it can never ADD new rows
| to the result, and to remove half-matched rows we do scan anyway
| to the result, and to remove half-matched rows we do scan anyway
2. -trunc*
2. -trunc*
| same as 1.
| same as 1.
3. trunc*
3. in 1 and 2, +/- need not be on the same expr. level,
but can be on any upper level, as in +word +(trunc1* trunc2*)
4. otherwise
| We have to index-search for this prefix.
| We have to index-search for this prefix.
| It may cause duplicates, as in the index (sorted by <word,docid>)
| It may cause duplicates, as in the index (sorted by <word,docid>)
| <aaaa,row1>
| <aaaa,row1>
...
@@ -313,23 +317,32 @@ static void _ftb_init_index_search(FT_INFO *ftb)
...
@@ -313,23 +317,32 @@ static void _ftb_init_index_search(FT_INFO *ftb)
| <aacc,row1>
| <aacc,row1>
| Searching for "aa*" will find row1 twice...
| Searching for "aa*" will find row1 twice...
*/
*/
if
(
test
(
ftbw
->
flags
&
FTB_FLAG_NO
)
||
/* 2 */
FTB_EXPR
*
ftbe
;
(
test
(
ftbw
->
flags
&
FTB_FLAG_YES
)
&&
/* 1 */
for
(
ftbe
=
(
FTB_EXPR
*
)
ftbw
;
ftbw
->
up
->
ythresh
-
ftbw
->
up
->
yweaks
>
1
))
/* 1 */
ftbe
->
up
&&
!
(
ftbe
->
up
->
flags
&
FTB_FLAG_TRUNC
);
ftbe
->
up
->
flags
|=
FTB_FLAG_TRUNC
,
ftbe
=
ftbe
->
up
)
{
if
(
ftbe
->
flags
&
FTB_FLAG_NO
||
/* 2 */
ftbe
->
up
->
ythresh
-
ftbe
->
up
->
yweaks
>
1
)
/* 1 */
{
{
FTB_EXPR
*
top_ftbe
=
ftbe
->
up
->
up
;
ftbw
->
docid
[
0
]
=
HA_POS_ERROR
;
ftbw
->
docid
[
0
]
=
HA_POS_ERROR
;
ftbw
->
up
->
yweaks
++
;
for
(
ftbe
=
ftbw
->
up
;
ftbe
!=
top_ftbe
;
ftbe
=
ftbe
->
up
)
continue
;
if
(
ftbe
->
flags
&
FTB_FLAG_YES
)
ftbe
->
yweaks
++
;
ftbe
=
0
;
break
;
}
}
else
/* 3 */
}
{
if
(
!
ftbe
)
continue
;
/* 3 */
if
(
!
is_tree_inited
(
&
ftb
->
no_dupes
))
if
(
!
is_tree_inited
(
&
ftb
->
no_dupes
))
init_tree
(
&
ftb
->
no_dupes
,
0
,
0
,
sizeof
(
my_off_t
),
init_tree
(
&
ftb
->
no_dupes
,
0
,
0
,
sizeof
(
my_off_t
),
_ftb_no_dupes_cmp
,
0
,
NULL
,
NULL
);
_ftb_no_dupes_cmp
,
0
,
0
,
0
);
else
else
reset_tree
(
&
ftb
->
no_dupes
);
reset_tree
(
&
ftb
->
no_dupes
);
}
}
}
if
(
_ft2_search
(
ftb
,
ftbw
,
1
))
if
(
_ft2_search
(
ftb
,
ftbw
,
1
))
return
;
return
;
...
...
mysql-test/r/fulltext.result
View file @
05f1e100
...
@@ -161,6 +161,23 @@ Only MyISAM tables support collections
...
@@ -161,6 +161,23 @@ Only MyISAM tables support collections
Function MATCH ... AGAINST() is used to do a search
Function MATCH ... AGAINST() is used to do a search
some test foobar implements vector space model
some test foobar implements vector space model
drop table t1;
drop table t1;
create table t1 (a varchar(200) not null, fulltext (a));
insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
a
aaa10 bbb20
aaa20 bbb15
aaa30 bbb10
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
a
aaa20 bbb15
aaa30 bbb10
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
a
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
a
aaa10 bbb20
drop table t1;
CREATE TABLE t1 (
CREATE TABLE t1 (
id int(11),
id int(11),
ticket int(11),
ticket int(11),
...
...
mysql-test/r/fulltext_left_join.result
View file @
05f1e100
...
@@ -41,4 +41,12 @@ venue_id venue_text dt name entity_id
...
@@ -41,4 +41,12 @@ venue_id venue_text dt name entity_id
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
venue_id venue_text dt name entity_id
venue_id venue_text dt name entity_id
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00';
venue_id venue_text dt name entity_id
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
NULL a2 2003-05-23 19:30:00 NULL NULL
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
venue_id venue_text dt name entity_id
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
NULL a2 2003-05-23 19:30:00 NULL NULL
drop table t1,t2;
drop table t1,t2;
mysql-test/t/fulltext.test
View file @
05f1e100
...
@@ -80,6 +80,17 @@ delete from t1 where MATCH(a,b) AGAINST ("indexes");
...
@@ -80,6 +80,17 @@ delete from t1 where MATCH(a,b) AGAINST ("indexes");
select
*
from
t1
;
select
*
from
t1
;
drop
table
t1
;
drop
table
t1
;
#
# why to scan strings for trunc*
#
create
table
t1
(
a
varchar
(
200
)
not
null
,
fulltext
(
a
));
insert
t1
values
(
"aaa10 bbb20"
),
(
"aaa20 bbb15"
),
(
"aaa30 bbb10"
);
select
*
from
t1
where
match
a
against
(
"+aaa* +bbb*"
in
boolean
mode
);
select
*
from
t1
where
match
a
against
(
"+aaa* +bbb1*"
in
boolean
mode
);
select
*
from
t1
where
match
a
against
(
"+aaa* +ccc*"
in
boolean
mode
);
select
*
from
t1
where
match
a
against
(
"+aaa10 +(bbb*)"
in
boolean
mode
);
drop
table
t1
;
#
#
# Check bug reported by Matthias Urlichs
# Check bug reported by Matthias Urlichs
#
#
...
...
mysql-test/t/fulltext_left_join.test
View file @
05f1e100
...
@@ -41,5 +41,7 @@ create table t2 (name varchar(255) not null default '', entity_id int(11) not nu
...
@@ -41,5 +41,7 @@ create table t2 (name varchar(255) not null default '', entity_id int(11) not nu
insert
into
t2
(
name
,
entity_id
)
values
(
'aberdeen town hall'
,
1
),
(
'glasgow royal concert hall'
,
2
),
(
'queen\'s hall, edinburgh'
,
3
);
insert
into
t2
(
name
,
entity_id
)
values
(
'aberdeen town hall'
,
1
),
(
'glasgow royal concert hall'
,
2
),
(
'queen\'s hall, edinburgh'
,
3
);
select
*
from
t1
left
join
t2
on
venue_id
=
entity_id
where
match
(
name
)
against
(
'aberdeen'
in
boolean
mode
)
and
dt
=
'2003-05-23 19:30:00'
;
select
*
from
t1
left
join
t2
on
venue_id
=
entity_id
where
match
(
name
)
against
(
'aberdeen'
in
boolean
mode
)
and
dt
=
'2003-05-23 19:30:00'
;
select
*
from
t1
left
join
t2
on
venue_id
=
entity_id
where
match
(
name
)
against
(
'aberdeen'
)
and
dt
=
'2003-05-23 19:30:00'
;
select
*
from
t1
left
join
t2
on
venue_id
=
entity_id
where
match
(
name
)
against
(
'aberdeen'
)
and
dt
=
'2003-05-23 19:30:00'
;
select
*
from
t1
left
join
t2
on
(
venue_id
=
entity_id
and
match
(
name
)
against
(
'aberdeen'
in
boolean
mode
))
where
dt
=
'2003-05-23 19:30:00'
;
select
*
from
t1
left
join
t2
on
(
venue_id
=
entity_id
and
match
(
name
)
against
(
'aberdeen'
))
where
dt
=
'2003-05-23 19:30:00'
;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
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