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
722a4cc5
Commit
722a4cc5
authored
Nov 20, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
yet another trunc* bug
parent
d54e1be6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
20 deletions
+37
-20
myisam/ft_boolean_search.c
myisam/ft_boolean_search.c
+33
-20
mysql-test/r/fulltext.result
mysql-test/r/fulltext.result
+3
-0
mysql-test/t/fulltext.test
mysql-test/t/fulltext.test
+1
-0
No files found.
myisam/ft_boolean_search.c
View file @
722a4cc5
...
...
@@ -62,11 +62,12 @@ typedef struct st_ftb_expr FTB_EXPR;
struct
st_ftb_expr
{
FTB_EXPR
*
up
;
byte
*
quot
,
*
qend
;
float
weight
;
uint
flags
;
my_off_t
docid
[
2
];
/* for index search and for scan */
my_off_t
docid
[
2
];
/* ^^^^^^^^^^^^^^^^^^ FTB_{EXPR,WORD} common section */
float
cur_weight
;
byte
*
quot
,
*
qend
;
int
yesses
;
/* number of "yes" words matched */
int
nos
;
/* number of "no" words matched */
int
ythresh
;
/* number of "yes" words in expr */
...
...
@@ -78,7 +79,8 @@ typedef struct st_ftb_word
FTB_EXPR
*
up
;
float
weight
;
uint
flags
;
my_off_t
docid
[
2
];
/* for index search and for scan */
my_off_t
docid
[
2
];
/* ^^^^^^^^^^^^^^^^^^ FTB_{EXPR,WORD} common section */
uint
ndepth
;
int
len
;
/* ... docid cache can be added here. SerG */
...
...
@@ -217,13 +219,15 @@ static void _ftb_init_index_search(FT_INFO *ftb)
if
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
)
{
/*
special treatment for truncation operator
:((
1.
+trunc* and there're other (not +trunc*)
words
special treatment for truncation operator
1.
there are some (besides this) +
words
| 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
2. -trunc*
| 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.
| It may cause duplicates, as in the index (sorted by <word,docid>)
| <aaaa,row1>
...
...
@@ -231,22 +235,31 @@ static void _ftb_init_index_search(FT_INFO *ftb)
| <aacc,row1>
| Searching for "aa*" will find row1 twice...
*/
if
(
test
(
ftbw
->
flags
&
FTB_FLAG_NO
)
||
/* 2 */
(
test
(
ftbw
->
flags
&
FTB_FLAG_YES
)
&&
/* 1 */
ftbw
->
up
->
ythresh
-
ftbw
->
up
->
yweaks
>
1
))
/* 1 */
{
ftbw
->
docid
[
0
]
=
HA_POS_ERROR
;
ftbw
->
up
->
yweaks
++
;
continue
;
}
else
/* 3 */
FTB_EXPR
*
ftbe
;
for
(
ftbe
=
(
FTB_EXPR
*
)
ftbw
;
ftbe
->
up
&&
!
(
ftbe
->
up
->
flags
&
FTB_FLAG_TRUNC
);
ftbe
->
up
->
flags
|=
FTB_FLAG_TRUNC
,
ftbe
=
ftbe
->
up
)
{
if
(
!
is_tree_inited
(
&
ftb
->
no_dupes
))
init_tree
(
&
ftb
->
no_dupes
,
0
,
0
,
sizeof
(
my_off_t
),
_ftb_no_dupes_cmp
,
0
,
0
,
0
);
else
reset_tree
(
&
ftb
->
no_dupes
);
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
;
for
(
ftbe
=
ftbw
->
up
;
ftbe
!=
top_ftbe
;
ftbe
=
ftbe
->
up
)
if
(
ftbe
->
flags
&
FTB_FLAG_YES
)
ftbe
->
yweaks
++
;
ftbe
=
0
;
break
;
}
}
if
(
!
ftbe
)
continue
;
/* 3 */
if
(
!
is_tree_inited
(
&
ftb
->
no_dupes
))
init_tree
(
&
ftb
->
no_dupes
,
0
,
0
,
sizeof
(
my_off_t
),
_ftb_no_dupes_cmp
,
0
,
0
,
0
);
else
reset_tree
(
&
ftb
->
no_dupes
);
}
r
=
_mi_search
(
info
,
keyinfo
,
(
uchar
*
)
ftbw
->
word
,
ftbw
->
len
,
SEARCH_FIND
|
SEARCH_BIGGER
,
keyroot
);
...
...
mysql-test/r/fulltext.result
View file @
722a4cc5
...
...
@@ -147,6 +147,9 @@ 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 (
id int(11),
...
...
mysql-test/t/fulltext.test
View file @
722a4cc5
...
...
@@ -78,6 +78,7 @@ 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
;
#
...
...
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