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
08384a3a
Commit
08384a3a
authored
Apr 15, 2002
by
serg@serg.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getting rid of default_charset_info
parent
a7310464
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
31 deletions
+35
-31
myisam/ft_boolean_search.c
myisam/ft_boolean_search.c
+12
-8
myisam/ft_nlq_search.c
myisam/ft_nlq_search.c
+5
-2
myisam/ft_parser.c
myisam/ft_parser.c
+9
-10
myisam/ft_update.c
myisam/ft_update.c
+8
-11
myisam/ftdefs.h
myisam/ftdefs.h
+1
-0
No files found.
myisam/ft_boolean_search.c
View file @
08384a3a
...
...
@@ -84,6 +84,7 @@ typedef struct st_ft_info {
struct
_ft_vft
*
please
;
MI_INFO
*
info
;
uint
keynr
;
CHARSET_INFO
*
charset
;
enum
{
UNINITIALIZED
,
READY
,
INDEX_SEARCH
,
INDEX_DONE
/*, SCAN*/
}
state
;
uint
with_scan
;
FTB_EXPR
*
root
;
...
...
@@ -101,11 +102,11 @@ int FTB_WORD_cmp(void *v __attribute__((unused)), FTB_WORD *a, FTB_WORD *b)
return
i
;
}
int
FTB_WORD_cmp_list
(
void
*
v
__attribute__
((
unused
))
,
FTB_WORD
**
a
,
FTB_WORD
**
b
)
int
FTB_WORD_cmp_list
(
CHARSET_INFO
*
cs
,
FTB_WORD
**
a
,
FTB_WORD
**
b
)
{
/* ORDER BY word DESC, ndepth DESC */
int
i
=
_mi_compare_text
(
default_charset_info
,
(
*
b
)
->
word
+
1
,(
*
b
)
->
len
-
1
,
(
*
a
)
->
word
+
1
,(
*
a
)
->
len
-
1
,
0
);
int
i
=
_mi_compare_text
(
cs
,
(
*
b
)
->
word
+
1
,(
*
b
)
->
len
-
1
,
(
*
a
)
->
word
+
1
,(
*
a
)
->
len
-
1
,
0
);
if
(
!
i
)
i
=
CMP_NUM
((
*
b
)
->
ndepth
,(
*
a
)
->
ndepth
);
return
i
;
...
...
@@ -203,7 +204,7 @@ void _ftb_init_index_search(FT_INFO *ftb)
SEARCH_FIND
|
SEARCH_BIGGER
,
keyroot
);
if
(
!
r
)
{
r
=
_mi_compare_text
(
default_charset_info
,
r
=
_mi_compare_text
(
ftb
->
charset
,
info
->
lastkey
+
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
),
ftbw
->
len
-
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
),
ftbw
->
word
+
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
),
...
...
@@ -241,6 +242,9 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
ftb
->
state
=
UNINITIALIZED
;
ftb
->
info
=
info
;
ftb
->
keynr
=
keynr
;
ftb
->
charset
=
((
keynr
==
NO_SUCH_KEY
)
?
default_charset_info
:
info
->
s
->
keyinfo
[
keynr
].
seg
->
charset
);
ftb
->
with_scan
=
0
;
init_alloc_root
(
&
ftb
->
mem_root
,
1024
,
1024
);
...
...
@@ -265,7 +269,7 @@ FT_INFO * ft_init_boolean_search(MI_INFO *info, uint keynr, byte *query,
sizeof
(
FTB_WORD
*
)
*
ftb
->
queue
.
elements
);
memcpy
(
ftb
->
list
,
ftb
->
queue
.
root
+
1
,
sizeof
(
FTB_WORD
*
)
*
ftb
->
queue
.
elements
);
qsort2
(
ftb
->
list
,
ftb
->
queue
.
elements
,
sizeof
(
FTB_WORD
*
),
(
qsort2_cmp
)
FTB_WORD_cmp_list
,
0
);
(
qsort2_cmp
)
FTB_WORD_cmp_list
,
ftb
->
charset
);
if
(
ftb
->
queue
.
elements
<
2
)
ftb
->
with_scan
=
0
;
ftb
->
state
=
READY
;
return
ftb
;
...
...
@@ -359,7 +363,7 @@ int ft_boolean_read_next(FT_INFO *ftb, char *record)
SEARCH_BIGGER
,
keyroot
);
if
(
!
r
)
{
r
=
_mi_compare_text
(
default_charset_info
,
r
=
_mi_compare_text
(
ftb
->
charset
,
info
->
lastkey
+
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
),
ftbw
->
len
-
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
),
ftbw
->
word
+
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
),
...
...
@@ -443,7 +447,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
for
(
a
=
0
,
b
=
ftb
->
queue
.
elements
,
c
=
(
a
+
b
)
/
2
;
b
-
a
>
1
;
c
=
(
a
+
b
)
/
2
)
{
ftbw
=
(
FTB_WORD
*
)(
ftb
->
list
[
c
]);
if
(
_mi_compare_text
(
default_charset_info
,
word
.
pos
,
word
.
len
,
if
(
_mi_compare_text
(
ftb
->
charset
,
word
.
pos
,
word
.
len
,
(
uchar
*
)
ftbw
->
word
+
1
,
ftbw
->
len
-
1
,
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
)
)
>
0
)
b
=
c
;
...
...
@@ -453,7 +457,7 @@ float ft_boolean_find_relevance(FT_INFO *ftb, byte *record, uint length)
for
(;
c
>=
0
;
c
--
)
{
ftbw
=
(
FTB_WORD
*
)(
ftb
->
list
[
c
]);
if
(
_mi_compare_text
(
default_charset_info
,
word
.
pos
,
word
.
len
,
if
(
_mi_compare_text
(
ftb
->
charset
,
word
.
pos
,
word
.
len
,
(
uchar
*
)
ftbw
->
word
+
1
,
ftbw
->
len
-
1
,
(
ftbw
->
flags
&
FTB_FLAG_TRUNC
)
))
break
;
...
...
myisam/ft_nlq_search.c
View file @
08384a3a
...
...
@@ -37,6 +37,7 @@ struct st_ft_info {
typedef
struct
st_all_in_one
{
MI_INFO
*
info
;
uint
keynr
;
CHARSET_INFO
*
charset
;
uchar
*
keybuff
;
MI_KEYDEF
*
keyinfo
;
my_off_t
key_root
;
...
...
@@ -93,7 +94,7 @@ static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
while
(
!
r
)
{
if
(
_mi_compare_text
(
default_charset_info
,
if
(
_mi_compare_text
(
aio
->
charset
,
aio
->
info
->
lastkey
,
keylen
,
aio
->
keybuff
,
keylen
,
0
))
break
;
...
...
@@ -184,8 +185,9 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
aio
.
info
=
info
;
aio
.
keynr
=
keynr
;
aio
.
keybuff
=
info
->
lastkey
+
info
->
s
->
base
.
max_key_length
;
aio
.
keyinfo
=
info
->
s
->
keyinfo
+
keynr
;
aio
.
charset
=
aio
.
keyinfo
->
seg
->
charset
;
aio
.
keybuff
=
info
->
lastkey
+
info
->
s
->
base
.
max_key_length
;
aio
.
key_root
=
info
->
s
->
state
.
key_root
[
keynr
];
bzero
(
&
allocated_wtree
,
sizeof
(
allocated_wtree
));
...
...
@@ -193,6 +195,7 @@ FT_INFO *ft_init_nlq_search(MI_INFO *info, uint keynr, byte *query,
init_tree
(
&
aio
.
dtree
,
0
,
0
,
sizeof
(
FT_SUPERDOC
),(
qsort_cmp2
)
&
FT_SUPERDOC_cmp
,
0
,
NULL
,
NULL
);
ft_parse_init
(
&
allocated_wtree
,
aio
.
charset
);
if
(
ft_parse
(
&
allocated_wtree
,
query
,
query_len
))
goto
err
;
...
...
myisam/ft_parser.c
View file @
08384a3a
...
...
@@ -35,12 +35,10 @@ typedef struct st_ft_docstat {
}
FT_DOCSTAT
;
static
int
FT_WORD_cmp
(
void
*
cmp_arg
,
FT_WORD
*
w1
,
FT_WORD
*
w2
)
static
int
FT_WORD_cmp
(
CHARSET_INFO
*
cs
,
FT_WORD
*
w1
,
FT_WORD
*
w2
)
{
return
_mi_compare_text
(
default_charset_info
,
(
uchar
*
)
w1
->
pos
,
w1
->
len
,
(
uchar
*
)
w2
->
pos
,
w2
->
len
,
(
my_bool
)
(
cmp_arg
!=
0
));
return
_mi_compare_text
(
cs
,
(
uchar
*
)
w1
->
pos
,
w1
->
len
,
(
uchar
*
)
w2
->
pos
,
w2
->
len
,
0
);
}
static
int
walk_and_copy
(
FT_WORD
*
word
,
uint32
count
,
FT_DOCSTAT
*
docstat
)
...
...
@@ -207,16 +205,17 @@ byte ft_simple_get_word(byte **start, byte *end, FT_WORD *word)
return
0
;
}
void
ft_parse_init
(
TREE
*
wtree
,
CHARSET_INFO
*
cs
)
{
if
(
!
is_tree_inited
(
wtree
))
init_tree
(
wtree
,
0
,
0
,
sizeof
(
FT_WORD
),(
qsort_cmp2
)
&
FT_WORD_cmp
,
0
,
NULL
,
cs
);
}
int
ft_parse
(
TREE
*
wtree
,
byte
*
doc
,
int
doclen
)
{
byte
*
end
=
doc
+
doclen
;
FT_WORD
w
;
if
(
!
is_tree_inited
(
wtree
))
{
init_tree
(
wtree
,
0
,
0
,
sizeof
(
FT_WORD
),(
qsort_cmp2
)
&
FT_WORD_cmp
,
0
,
NULL
,
NULL
);
}
while
(
ft_simple_get_word
(
&
doc
,
end
,
&
w
))
{
if
(
!
tree_insert
(
wtree
,
&
w
,
0
))
...
...
myisam/ft_update.c
View file @
08384a3a
...
...
@@ -90,16 +90,13 @@ uint _mi_ft_parse(TREE *parsed, MI_INFO *info, uint keynr, const byte *record)
FT_SEG_ITERATOR
ftsi
;
_mi_ft_segiterator_init
(
info
,
keynr
,
record
,
&
ftsi
);
ft_parse_init
(
parsed
,
info
->
s
->
keyinfo
[
keynr
].
seg
->
charset
);
while
(
_mi_ft_segiterator
(
&
ftsi
))
if
(
ftsi
.
pos
)
if
(
ft_parse
(
parsed
,
(
byte
*
)
ftsi
.
pos
,
ftsi
.
len
))
return
1
;
/* Handle the case where all columns are NULL */
if
(
!
is_tree_inited
(
parsed
)
&&
ft_parse
(
parsed
,
(
byte
*
)
""
,
0
))
return
1
;
else
return
0
;
return
0
;
}
FT_WORD
*
_mi_ft_parserecord
(
MI_INFO
*
info
,
uint
keynr
,
...
...
@@ -153,6 +150,7 @@ static int _mi_ft_erase(MI_INFO *info, uint keynr, byte *keybuf, FT_WORD *wlist,
int
_mi_ft_cmp
(
MI_INFO
*
info
,
uint
keynr
,
const
byte
*
rec1
,
const
byte
*
rec2
)
{
FT_SEG_ITERATOR
ftsi1
,
ftsi2
;
CHARSET_INFO
*
cs
=
info
->
s
->
keyinfo
[
keynr
].
seg
->
charset
;
_mi_ft_segiterator_init
(
info
,
keynr
,
rec1
,
&
ftsi1
);
_mi_ft_segiterator_init
(
info
,
keynr
,
rec2
,
&
ftsi2
);
...
...
@@ -160,9 +158,8 @@ int _mi_ft_cmp(MI_INFO *info, uint keynr, const byte *rec1, const byte *rec2)
{
if
((
ftsi1
.
pos
!=
ftsi2
.
pos
)
&&
(
!
ftsi1
.
pos
||
!
ftsi2
.
pos
||
_mi_compare_text
(
default_charset_info
,
(
uchar
*
)
ftsi1
.
pos
,
ftsi1
.
len
,
(
uchar
*
)
ftsi2
.
pos
,
ftsi2
.
len
,
0
)))
_mi_compare_text
(
cs
,
(
uchar
*
)
ftsi1
.
pos
,
ftsi1
.
len
,
(
uchar
*
)
ftsi2
.
pos
,
ftsi2
.
len
,
0
)))
return
THOSE_TWO_DAMN_KEYS_ARE_REALLY_DIFFERENT
;
}
return
GEE_THEY_ARE_ABSOLUTELY_IDENTICAL
;
...
...
@@ -174,6 +171,7 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
{
int
error
=
-
1
;
FT_WORD
*
oldlist
,
*
newlist
,
*
old_word
,
*
new_word
;
CHARSET_INFO
*
cs
=
info
->
s
->
keyinfo
[
keynr
].
seg
->
charset
;
uint
key_length
;
int
cmp
,
cmp2
;
...
...
@@ -185,9 +183,8 @@ int _mi_ft_update(MI_INFO *info, uint keynr, byte *keybuf,
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
);
cmp
=
_mi_compare_text
(
cs
,
(
uchar
*
)
old_word
->
pos
,
old_word
->
len
,
(
uchar
*
)
new_word
->
pos
,
new_word
->
len
,
0
);
cmp2
=
cmp
?
0
:
(
fabs
(
old_word
->
weight
-
new_word
->
weight
)
>
1.e-5
);
if
(
cmp
<
0
||
cmp2
)
...
...
myisam/ftdefs.h
View file @
08384a3a
...
...
@@ -130,6 +130,7 @@ void _mi_ft_segiterator_init(MI_INFO *, uint, const byte *, FT_SEG_ITERATOR *);
void
_mi_ft_segiterator_dummy_init
(
const
byte
*
,
uint
,
FT_SEG_ITERATOR
*
);
uint
_mi_ft_segiterator
(
FT_SEG_ITERATOR
*
);
void
ft_parse_init
(
TREE
*
,
CHARSET_INFO
*
);
int
ft_parse
(
TREE
*
,
byte
*
,
int
);
FT_WORD
*
ft_linearize
(
/*MI_INFO *, uint, byte *, */
TREE
*
);
FT_WORD
*
_mi_ft_parserecord
(
MI_INFO
*
,
uint
,
byte
*
,
const
byte
*
);
...
...
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