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
5227a8b1
Commit
5227a8b1
authored
May 07, 2002
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge work:/home/bk/mysql-4.0
into rhols221.adsl.netsonic.fi:/home/my/bk/mysql-4.0
parents
9f8a75a1
3e404b75
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
12 deletions
+52
-12
myisam/ft_boolean_search.c
myisam/ft_boolean_search.c
+43
-12
mysql-test/r/fulltext.result
mysql-test/r/fulltext.result
+5
-0
mysql-test/t/fulltext.test
mysql-test/t/fulltext.test
+4
-0
No files found.
myisam/ft_boolean_search.c
View file @
5227a8b1
...
@@ -77,7 +77,7 @@ typedef struct st_ftb_word {
...
@@ -77,7 +77,7 @@ typedef struct st_ftb_word {
my_off_t
docid
[
2
];
/* for index search and for scan */
my_off_t
docid
[
2
];
/* for index search and for scan */
uint
ndepth
;
uint
ndepth
;
int
len
;
int
len
;
/* ...
there can be docid cach
e added here. SerG */
/* ...
docid cache can b
e added here. SerG */
byte
word
[
1
];
byte
word
[
1
];
}
FTB_WORD
;
}
FTB_WORD
;
...
@@ -90,6 +90,7 @@ typedef struct st_ft_info {
...
@@ -90,6 +90,7 @@ typedef struct st_ft_info {
uint
with_scan
;
uint
with_scan
;
FTB_EXPR
*
root
;
FTB_EXPR
*
root
;
QUEUE
queue
;
QUEUE
queue
;
TREE
no_dupes
;
FTB_WORD
**
list
;
FTB_WORD
**
list
;
MEM_ROOT
mem_root
;
MEM_ROOT
mem_root
;
}
FTB
;
}
FTB
;
...
@@ -174,7 +175,12 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
...
@@ -174,7 +175,12 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
return
;
return
;
}
}
void
_ftb_init_index_search
(
FT_INFO
*
ftb
)
static
int
_ftb_no_dupes_cmp
(
void
*
not_used
,
const
void
*
a
,
const
void
*
b
)
{
return
CMP_NUM
((
*
((
my_off_t
*
)
a
)),
(
*
((
my_off_t
*
)
b
)));
}
void
_ftb_init_index_search
(
FT_INFO
*
ftb
)
{
{
int
i
,
r
;
int
i
,
r
;
FTB_WORD
*
ftbw
;
FTB_WORD
*
ftbw
;
...
@@ -193,16 +199,31 @@ void _ftb_init_index_search(FT_INFO *ftb)
...
@@ -193,16 +199,31 @@ void _ftb_init_index_search(FT_INFO *ftb)
{
{
ftbw
=
(
FTB_WORD
*
)(
ftb
->
queue
.
root
[
i
]);
ftbw
=
(
FTB_WORD
*
)(
ftb
->
queue
.
root
[
i
]);
if
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
&&
if
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
)
/* special treatment :(( */
(
ftbw
->
up
->
ythresh
>
test
(
ftbw
->
flags
&
FTB_FLAG_YES
)))
if
(
ftbw
->
up
->
ythresh
>
test
(
ftbw
->
flags
&
FTB_FLAG_YES
))
{
{
/* no need to search for this prefix in the index -
/* no need to search for this prefix in the index -
* it cannot ADD new matches, and to REMOVE half-matched
* it cannot ADD new matches, and to REMOVE half-matched
* rows we do scan anyway */
* rows we do scan anyway */
ftbw
->
docid
[
0
]
=
HA_POS_ERROR
;
ftbw
->
docid
[
0
]
=
HA_POS_ERROR
;
ftbw
->
up
->
yweaks
++
;
ftbw
->
up
->
yweaks
++
;
continue
;
continue
;
}
}
else
{
/* We have to index-search for this prefix.
* It may cause duplicates, as in the index (sorted by <word,docid>)
* <aaaa,row1>
* <aabb,row2>
* <aacc,row1>
* Searching for "aa*" will find row1 twice...
*/
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
);
}
}
r
=
_mi_search
(
info
,
keyinfo
,
(
uchar
*
)
ftbw
->
word
,
ftbw
->
len
,
r
=
_mi_search
(
info
,
keyinfo
,
(
uchar
*
)
ftbw
->
word
,
ftbw
->
len
,
SEARCH_FIND
|
SEARCH_BIGGER
,
keyroot
);
SEARCH_FIND
|
SEARCH_BIGGER
,
keyroot
);
...
@@ -250,6 +271,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
...
@@ -250,6 +271,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
default_charset_info
:
default_charset_info
:
info
->
s
->
keyinfo
[
keynr
].
seg
->
charset
);
info
->
s
->
keyinfo
[
keynr
].
seg
->
charset
);
ftb
->
with_scan
=
0
;
ftb
->
with_scan
=
0
;
bzero
(
&
ftb
->
no_dupes
,
sizeof
(
TREE
));
init_alloc_root
(
&
ftb
->
mem_root
,
1024
,
1024
);
init_alloc_root
(
&
ftb
->
mem_root
,
1024
,
1024
);
...
@@ -438,6 +460,11 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
...
@@ -438,6 +460,11 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
ftbe
->
yesses
>=
(
ftbe
->
ythresh
-
ftbe
->
yweaks
)
&&
!
ftbe
->
nos
)
ftbe
->
yesses
>=
(
ftbe
->
ythresh
-
ftbe
->
yweaks
)
&&
!
ftbe
->
nos
)
{
{
/* curdoc matched ! */
/* curdoc matched ! */
if
(
is_tree_inited
(
&
ftb
->
no_dupes
)
&&
tree_insert
(
&
ftb
->
no_dupes
,
&
curdoc
,
0
)
->
count
>
1
)
/* but it managed to get past this line once */
continue
;
info
->
lastpos
=
curdoc
;
info
->
lastpos
=
curdoc
;
info
->
update
&=
(
HA_STATE_CHANGED
|
HA_STATE_ROW_CHANGED
);
/* why is this ? */
info
->
update
&=
(
HA_STATE_CHANGED
|
HA_STATE_ROW_CHANGED
);
/* why is this ? */
...
@@ -523,6 +550,10 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
...
@@ -523,6 +550,10 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
void
ft_boolean_close_search
(
FT_INFO
*
ftb
)
void
ft_boolean_close_search
(
FT_INFO
*
ftb
)
{
{
if
(
is_tree_inited
(
&
ftb
->
no_dupes
))
{
delete_tree
(
&
ftb
->
no_dupes
);
}
free_root
(
&
ftb
->
mem_root
,
MYF
(
0
));
free_root
(
&
ftb
->
mem_root
,
MYF
(
0
));
my_free
((
gptr
)
ftb
,
MYF
(
0
));
my_free
((
gptr
)
ftb
,
MYF
(
0
));
}
}
...
...
mysql-test/r/fulltext.result
View file @
5227a8b1
...
@@ -173,4 +173,9 @@ CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM;
...
@@ -173,4 +173,9 @@ CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM;
insert into t1 values (1,"I wonder why the fulltext index doesnt work?");
insert into t1 values (1,"I wonder why the fulltext index doesnt work?");
SELECT * from t1 where MATCH (b) AGAINST ('apples');
SELECT * from t1 where MATCH (b) AGAINST ('apples');
a b
a b
insert into t1 values (2,"fullaaa fullzzz");
select * from t1 where match b against ('full*' in boolean mode);
a b
2 fullaaa fullzzz
1 I wonder why the fulltext index doesnt work?
drop table t1;
drop table t1;
mysql-test/t/fulltext.test
View file @
5227a8b1
...
@@ -145,4 +145,8 @@ CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM;
...
@@ -145,4 +145,8 @@ CREATE TABLE t1 (a int(11), b text, FULLTEXT KEY (b)) TYPE=MyISAM;
insert
into
t1
values
(
1
,
"I wonder why the fulltext index doesnt work?"
);
insert
into
t1
values
(
1
,
"I wonder why the fulltext index doesnt work?"
);
SELECT
*
from
t1
where
MATCH
(
b
)
AGAINST
(
'apples'
);
SELECT
*
from
t1
where
MATCH
(
b
)
AGAINST
(
'apples'
);
insert
into
t1
values
(
2
,
"fullaaa fullzzz"
);
select
*
from
t1
where
match
b
against
(
'full*'
in
boolean
mode
);
drop
table
t1
;
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