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
d9ff111a
Commit
d9ff111a
authored
Mar 04, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug with indexless boolean fts fixed
parent
19d37eca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
6 deletions
+20
-6
myisam/ft_boolean_search.c
myisam/ft_boolean_search.c
+10
-4
mysql-test/r/fulltext.result
mysql-test/r/fulltext.result
+8
-1
mysql-test/t/fulltext.test
mysql-test/t/fulltext.test
+2
-1
No files found.
myisam/ft_boolean_search.c
View file @
d9ff111a
...
@@ -81,17 +81,21 @@ typedef struct st_ft_info {
...
@@ -81,17 +81,21 @@ typedef struct st_ft_info {
MI_INFO
*
info
;
MI_INFO
*
info
;
uint
keynr
;
uint
keynr
;
enum
{
UNINITIALIZED
,
READY
,
INDEX_SEARCH
,
INDEX_DONE
,
SCAN
}
state
;
enum
{
UNINITIALIZED
,
READY
,
INDEX_SEARCH
,
INDEX_DONE
,
SCAN
}
state
;
uint
with_scan
;
FTB_EXPR
*
root
;
FTB_EXPR
*
root
;
QUEUE
queue
;
QUEUE
queue
;
MEM_ROOT
mem_root
;
MEM_ROOT
mem_root
;
}
FTB
;
}
FTB
;
int
FTB_WORD_cmp
(
void
*
v
__attribute__
((
unused
)),
byte
*
a
,
byte
*
b
)
int
FTB_WORD_cmp
(
void
*
v
__attribute__
((
unused
)),
FTB_WORD
*
a
,
FTB_WORD
*
b
)
{
{
/* ORDER BY docid, ndepth DESC */
/* ORDER BY docid, ndepth DESC */
int
i
=
CMP_NUM
(
((
FTB_WORD
*
)
a
)
->
docid
,
((
FTB_WORD
*
)
b
)
->
docid
);
int
i
=
CMP_NUM
(
a
->
docid
,
b
->
docid
);
if
(
!
i
)
if
(
!
i
)
i
=
CMP_NUM
(((
FTB_WORD
*
)
b
)
->
ndepth
,((
FTB_WORD
*
)
a
)
->
ndepth
);
i
=
CMP_NUM
(
b
->
ndepth
,
a
->
ndepth
);
if
(
!
i
)
i
=
_mi_compare_text
(
default_charset_info
,
b
->
word
+
1
,
b
->
len
-
1
,
a
->
word
+
1
,
a
->
len
-
1
,
0
);
return
i
;
return
i
;
}
}
...
@@ -130,6 +134,7 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
...
@@ -130,6 +134,7 @@ void _ftb_parse_query(FTB *ftb, byte **start, byte *end,
ftbw
->
word
[
0
]
=
w
.
len
;
ftbw
->
word
[
0
]
=
w
.
len
;
if
(
ftbw
->
yesno
>
0
)
up
->
ythresh
++
;
if
(
ftbw
->
yesno
>
0
)
up
->
ythresh
++
;
queue_insert
(
&
ftb
->
queue
,
(
byte
*
)
ftbw
);
queue_insert
(
&
ftb
->
queue
,
(
byte
*
)
ftbw
);
ftb
->
with_scan
|=
ftbw
->
trunc
;
break
;
break
;
case
2
:
/* left bracket */
case
2
:
/* left bracket */
ftbe
=
(
FTB_EXPR
*
)
alloc_root
(
&
ftb
->
mem_root
,
sizeof
(
FTB_EXPR
));
ftbe
=
(
FTB_EXPR
*
)
alloc_root
(
&
ftb
->
mem_root
,
sizeof
(
FTB_EXPR
));
...
@@ -207,6 +212,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
...
@@ -207,6 +212,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
ftb
->
state
=
UNINITIALIZED
;
ftb
->
state
=
UNINITIALIZED
;
ftb
->
info
=
info
;
ftb
->
info
=
info
;
ftb
->
keynr
=
keynr
;
ftb
->
keynr
=
keynr
;
ftb
->
with_scan
=
0
;
init_alloc_root
(
&
ftb
->
mem_root
,
1024
,
1024
);
init_alloc_root
(
&
ftb
->
mem_root
,
1024
,
1024
);
...
@@ -215,7 +221,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
...
@@ -215,7 +221,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
*/
*/
res
=
ftb
->
queue
.
max_elements
=
query_len
/
(
ft_min_word_len
+
1
);
res
=
ftb
->
queue
.
max_elements
=
query_len
/
(
ft_min_word_len
+
1
);
ftb
->
queue
.
root
=
(
byte
**
)
alloc_root
(
&
ftb
->
mem_root
,
(
res
+
1
)
*
sizeof
(
void
*
));
ftb
->
queue
.
root
=
(
byte
**
)
alloc_root
(
&
ftb
->
mem_root
,
(
res
+
1
)
*
sizeof
(
void
*
));
reinit_queue
(
&
ftb
->
queue
,
res
,
0
,
0
,
FTB_WORD_cmp
,
ftb
);
reinit_queue
(
&
ftb
->
queue
,
res
,
0
,
0
,
(
int
(
*
)(
void
*
,
byte
*
,
byte
*
))
FTB_WORD_cmp
,
ftb
);
ftbe
=
(
FTB_EXPR
*
)
alloc_root
(
&
ftb
->
mem_root
,
sizeof
(
FTB_EXPR
));
ftbe
=
(
FTB_EXPR
*
)
alloc_root
(
&
ftb
->
mem_root
,
sizeof
(
FTB_EXPR
));
ftbe
->
weight
=
1
;
ftbe
->
weight
=
1
;
ftbe
->
yesno
=
ftbe
->
nos
=
1
;
ftbe
->
yesno
=
ftbe
->
nos
=
1
;
...
...
mysql-test/r/fulltext.result
View file @
d9ff111a
...
@@ -48,7 +48,14 @@ Full-text search in MySQL implements vector space model
...
@@ -48,7 +48,14 @@ Full-text search in MySQL implements vector space model
select * from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
select * from t1 where MATCH(a,b) AGAINST("+search -(support vector)" IN BOOLEAN MODE);
a b
a b
Function MATCH ... AGAINST() is used to do a search
Function MATCH ... AGAINST() is used to do a search
select *, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
select *, MATCH(a,b) AGAINST("support collections" IN BOOLEAN MODE) as x from t1;
a b x
MySQL has now support for full-text search 1
Full-text indexes are called collections 1
Only MyISAM tables support collections 2
Function MATCH ... AGAINST() is used to do a search 0
Full-text search in MySQL implements vector space model 0
select *, MATCH(a,b) AGAINST("collections support" IN BOOLEAN MODE) as x from t1;
a b x
a b x
MySQL has now support for full-text search 1
MySQL has now support for full-text search 1
Full-text indexes are called collections 1
Full-text indexes are called collections 1
...
...
mysql-test/t/fulltext.test
View file @
d9ff111a
...
@@ -27,7 +27,8 @@ select * from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MOD
...
@@ -27,7 +27,8 @@ select * from t1 where MATCH(a,b) AGAINST("+support +collections" IN BOOLEAN MOD
select
*
from
t1
where
MATCH
(
a
,
b
)
AGAINST
(
"+search"
IN
BOOLEAN
MODE
);
select
*
from
t1
where
MATCH
(
a
,
b
)
AGAINST
(
"+search"
IN
BOOLEAN
MODE
);
select
*
from
t1
where
MATCH
(
a
,
b
)
AGAINST
(
"+search +(support vector)"
IN
BOOLEAN
MODE
);
select
*
from
t1
where
MATCH
(
a
,
b
)
AGAINST
(
"+search +(support vector)"
IN
BOOLEAN
MODE
);
select
*
from
t1
where
MATCH
(
a
,
b
)
AGAINST
(
"+search -(support vector)"
IN
BOOLEAN
MODE
);
select
*
from
t1
where
MATCH
(
a
,
b
)
AGAINST
(
"+search -(support vector)"
IN
BOOLEAN
MODE
);
select
*
,
MATCH
(
a
,
b
)
AGAINST
(
"support collections"
IN
BOOLEAN
MODE
)
as
x
from
t1
;
select
*
,
MATCH
(
a
,
b
)
AGAINST
(
"support collections"
IN
BOOLEAN
MODE
)
as
x
from
t1
;
select
*
,
MATCH
(
a
,
b
)
AGAINST
(
"collections support"
IN
BOOLEAN
MODE
)
as
x
from
t1
;
# boolean w/o index:
# boolean w/o index:
...
...
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