FullText example madness !
Posted by: Richard Shea
Date: May 20, 2010 04:26AM
Date: May 20, 2010 04:26AM
Hi - I've just followed the FULLTEXT example at http://dev.mysql.com/doc/refman/5.1/en/fulltext-boolean.html . I'll post it here for ease of reference ...
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
);
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...');
SELECT * FROM articles
WHERE MATCH (title,body)
AGAINST ('database' IN NATURAL LANGUAGE MODE);
... my problem is that the example shows that SELECT returning two rows ('DataBase' and 'database') but I only get one row ('database') !
The example doesn't demonstrate what collation the table ended up with but I have ended up with latin1_general_cs on the title and body columns.
My version of MySQL is 5.1.39-log and the connection collation is utf8_unicode_ci .
I'd be really grateful is someone could suggest why my experience differs from the example in the manual !
In case it's significant here's a dump of the server variables.
Be grateful for any advice.
Variable Session value / Global value
auto increment increment 1
auto increment offset 1
autocommit ON
automatic sp privileges ON
back log 50
basedir /data/mysql/kyong/
big tables OFF
binlog cache size 32,768
binlog format STATEMENT
bulk insert buffer size 8,388,608
character set client utf8
(Global value) latin1
character set connection utf8
(Global value) latin1
character set database latin1
character set filesystem binary
character set results utf8
(Global value) latin1
character set server latin1
character set system utf8
character sets dir /data/mysql/kyong/share/mysql/charsets/
collation connection utf8_unicode_ci
(Global value) latin1_swedish_ci
collation database latin1_swedish_ci
collation server latin1_swedish_ci
completion type 0
concurrent insert 1
connect timeout 10
datadir /dh/mysql/kyong/data/
date format %Y-%m-%d
datetime format %Y-%m-%d %H:%i:%s
default week format 0
delay key write ON
delayed insert limit 100
delayed insert timeout 300
delayed queue size 1,000
div precision increment 4
engine condition pushdown ON
error count 0
event scheduler DISABLED
expire logs days 0
flush OFF
flush time 0
foreign key checks ON
ft boolean syntax + -><()~*:""&|
ft max word len 84
ft min word len 3
ft query expansion limit 20
ft stopword file (built-in)
general log ON
general log file /dh/mysql/logs/mysql.kyong.log
group concat max len 1,024
have community features YES
have compress YES
have crypt YES
have csv YES
have dynamic loading YES
have geometry YES
have innodb YES
have ndbcluster NO
have openssl DISABLED
have partitioning NO
have query cache YES
have rtree keys YES
have ssl DISABLED
have symlink YES
hostname fang
identity 0
ignore builtin innodb OFF
init connect
init file
init slave
innodb adaptive hash index ON
innodb additional mem pool size 1,048,576
innodb autoextend increment 8
innodb autoinc lock mode 1
innodb buffer pool size 7,340,032
innodb checksums ON
innodb commit concurrency 0
innodb concurrency tickets 500
innodb data file path ibdata1:10M:autoextend
innodb data home dir
innodb doublewrite ON
innodb fast shutdown 1
innodb file io threads 4
innodb file per table ON
innodb flush log at trx commit 1
innodb flush method
innodb force recovery 0
innodb lock wait timeout 50
innodb locks unsafe for binlog OFF
innodb log buffer size 2,097,152
innodb log file size 5,242,880
innodb log files in group 2
innodb log group home dir ./
innodb max dirty pages pct 90
innodb max purge lag 0
innodb mirrored log groups 1
innodb open files 1,000
innodb rollback on timeout OFF
innodb stats on metadata ON
innodb support xa ON
innodb sync spin loops 20
innodb table locks ON
innodb thread concurrency 8
innodb thread sleep delay 10,000
innodb use legacy cardinality algorithm ON
insert id 0
interactive timeout 28,800
join buffer size 1,048,576
keep files on create OFF
key buffer size 7,340,032
key cache age threshold 300
key cache block size 1,024
key cache division limit 100
language /data/mysql/kyong/share/mysql/english/
large files support ON
large page size 0
large pages OFF
last insert id 0
lc time names en_US
license GPL
local infile ON
locked in memory OFF
log ON
log bin OFF
log bin trust function creators OFF
log bin trust routine creators OFF
log error /dh/mysql/logs/mysql.kyong.err
log output FILE
log queries not using indexes ON
log slave updates OFF
log slow queries ON
log warnings 2
long query time 10
low priority updates OFF
lower case file system OFF
lower case table names 0
max allowed packet 16,777,216
max binlog cache size 4,294,963,200
max binlog size 1,073,741,824
max connect errors 10,000
max connections 1,200
max delayed threads 20
max error count 64
max heap table size 16,777,216
max insert delayed threads 20
max join size 18446744073709551615
max length for sort data 1,024
max prepared stmt count 16,382
max relay log size 0
max seeks for key 4,294,967,295
max sort length 1,024
max sp recursion depth 0
max tmp tables 32
max user connections 300
max write lock count 4,294,967,295
min examined row limit 0
multi range count 256
myisam data pointer size 6
myisam max sort file size 2,146,435,072
myisam recover options BACKUP,FORCE
myisam repair threads 1
myisam sort buffer size 8,388,608
myisam stats method nulls_unequal
myisam use mmap OFF
net buffer length 16,384
net read timeout 30
net retry count 10
net write timeout 60
new ON
old OFF
old alter table OFF
old passwords ON
open files limit 1,000,500
optimizer prune level 1
optimizer search depth 62
optimizer switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on
pid file /tmp/mysql.kyong.pid
plugin dir /data/mysql/kyong/lib/mysql/plugin
port 3,306
preload buffer size 32,768
profiling OFF
profiling history size 15
protocol version 10
pseudo thread id 565,879
(Global value) 0
query alloc block size 8,192
query cache limit 5,242,880
query cache min res unit 4,096
query cache size 52,428,800
query cache type ON
query cache wlock invalidate OFF
query prealloc size 8,192
rand seed1
rand seed2
range alloc block size 4,096
read buffer size 1,048,576
read only OFF
read rnd buffer size 262,144
relay log
relay log index
relay log info file relay-log.info
relay log purge ON
relay log space limit 0
report host
report password
report port 3,306
report user
rpl recovery rank 0
secure auth OFF
secure file priv
server id 46,140
skip external locking ON
skip networking OFF
skip show database OFF
slave compressed protocol OFF
slave exec mode STRICT
slave load tmpdir /tmp
slave net timeout 3,600
slave skip errors OFF
slave transaction retries 10
slow launch time 2
slow query log ON
slow query log file /dh/mysql/logs/mysql.kyong.slow
socket /dh/mysql/kyong/mysql.kyong.sock
sort buffer size 1,048,576
sql auto is null ON
sql big selects ON
sql big tables OFF
sql buffer result OFF
sql log bin ON
sql log off OFF
sql log update ON
sql low priority updates OFF
sql max join size 18446744073709551615
sql mode
sql notes ON
sql quote show create ON
sql safe updates OFF
sql select limit 18446744073709551615
sql slave skip counter
sql warnings OFF
ssl ca
ssl capath
ssl cert
ssl cipher
ssl key
storage engine MyISAM
sync binlog 0
sync frm ON
system time zone PDT
table definition cache 256
table lock wait timeout 50
table open cache 350
table type MyISAM
thread cache size 20
thread handling one-thread-per-connection
thread stack 196,608
time format %H:%i:%s
time zone SYSTEM
timed mutexes OFF
timestamp 1,274,350,444
tmp table size 16,777,216
tmpdir /tmp
transaction alloc block size 8,192
transaction prealloc size 4,096
tx isolation REPEATABLE-READ
unique checks ON
updatable views with limit YES
version 5.1.39-log
version comment MySQL Server
version compile machine i486
version compile os pc-linux-gnu
wait timeout 14,400
warning count 0
CREATE TABLE articles (
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
title VARCHAR(200),
body TEXT,
FULLTEXT (title,body)
);
INSERT INTO articles (title,body) VALUES
('MySQL Tutorial','DBMS stands for DataBase ...'),
('How To Use MySQL Well','After you went through a ...'),
('Optimizing MySQL','In this tutorial we will show ...'),
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
('MySQL vs. YourSQL','In the following database comparison ...'),
('MySQL Security','When configured properly, MySQL ...');
SELECT * FROM articles
WHERE MATCH (title,body)
AGAINST ('database' IN NATURAL LANGUAGE MODE);
... my problem is that the example shows that SELECT returning two rows ('DataBase' and 'database') but I only get one row ('database') !
The example doesn't demonstrate what collation the table ended up with but I have ended up with latin1_general_cs on the title and body columns.
My version of MySQL is 5.1.39-log and the connection collation is utf8_unicode_ci .
I'd be really grateful is someone could suggest why my experience differs from the example in the manual !
In case it's significant here's a dump of the server variables.
Be grateful for any advice.
Variable Session value / Global value
auto increment increment 1
auto increment offset 1
autocommit ON
automatic sp privileges ON
back log 50
basedir /data/mysql/kyong/
big tables OFF
binlog cache size 32,768
binlog format STATEMENT
bulk insert buffer size 8,388,608
character set client utf8
(Global value) latin1
character set connection utf8
(Global value) latin1
character set database latin1
character set filesystem binary
character set results utf8
(Global value) latin1
character set server latin1
character set system utf8
character sets dir /data/mysql/kyong/share/mysql/charsets/
collation connection utf8_unicode_ci
(Global value) latin1_swedish_ci
collation database latin1_swedish_ci
collation server latin1_swedish_ci
completion type 0
concurrent insert 1
connect timeout 10
datadir /dh/mysql/kyong/data/
date format %Y-%m-%d
datetime format %Y-%m-%d %H:%i:%s
default week format 0
delay key write ON
delayed insert limit 100
delayed insert timeout 300
delayed queue size 1,000
div precision increment 4
engine condition pushdown ON
error count 0
event scheduler DISABLED
expire logs days 0
flush OFF
flush time 0
foreign key checks ON
ft boolean syntax + -><()~*:""&|
ft max word len 84
ft min word len 3
ft query expansion limit 20
ft stopword file (built-in)
general log ON
general log file /dh/mysql/logs/mysql.kyong.log
group concat max len 1,024
have community features YES
have compress YES
have crypt YES
have csv YES
have dynamic loading YES
have geometry YES
have innodb YES
have ndbcluster NO
have openssl DISABLED
have partitioning NO
have query cache YES
have rtree keys YES
have ssl DISABLED
have symlink YES
hostname fang
identity 0
ignore builtin innodb OFF
init connect
init file
init slave
innodb adaptive hash index ON
innodb additional mem pool size 1,048,576
innodb autoextend increment 8
innodb autoinc lock mode 1
innodb buffer pool size 7,340,032
innodb checksums ON
innodb commit concurrency 0
innodb concurrency tickets 500
innodb data file path ibdata1:10M:autoextend
innodb data home dir
innodb doublewrite ON
innodb fast shutdown 1
innodb file io threads 4
innodb file per table ON
innodb flush log at trx commit 1
innodb flush method
innodb force recovery 0
innodb lock wait timeout 50
innodb locks unsafe for binlog OFF
innodb log buffer size 2,097,152
innodb log file size 5,242,880
innodb log files in group 2
innodb log group home dir ./
innodb max dirty pages pct 90
innodb max purge lag 0
innodb mirrored log groups 1
innodb open files 1,000
innodb rollback on timeout OFF
innodb stats on metadata ON
innodb support xa ON
innodb sync spin loops 20
innodb table locks ON
innodb thread concurrency 8
innodb thread sleep delay 10,000
innodb use legacy cardinality algorithm ON
insert id 0
interactive timeout 28,800
join buffer size 1,048,576
keep files on create OFF
key buffer size 7,340,032
key cache age threshold 300
key cache block size 1,024
key cache division limit 100
language /data/mysql/kyong/share/mysql/english/
large files support ON
large page size 0
large pages OFF
last insert id 0
lc time names en_US
license GPL
local infile ON
locked in memory OFF
log ON
log bin OFF
log bin trust function creators OFF
log bin trust routine creators OFF
log error /dh/mysql/logs/mysql.kyong.err
log output FILE
log queries not using indexes ON
log slave updates OFF
log slow queries ON
log warnings 2
long query time 10
low priority updates OFF
lower case file system OFF
lower case table names 0
max allowed packet 16,777,216
max binlog cache size 4,294,963,200
max binlog size 1,073,741,824
max connect errors 10,000
max connections 1,200
max delayed threads 20
max error count 64
max heap table size 16,777,216
max insert delayed threads 20
max join size 18446744073709551615
max length for sort data 1,024
max prepared stmt count 16,382
max relay log size 0
max seeks for key 4,294,967,295
max sort length 1,024
max sp recursion depth 0
max tmp tables 32
max user connections 300
max write lock count 4,294,967,295
min examined row limit 0
multi range count 256
myisam data pointer size 6
myisam max sort file size 2,146,435,072
myisam recover options BACKUP,FORCE
myisam repair threads 1
myisam sort buffer size 8,388,608
myisam stats method nulls_unequal
myisam use mmap OFF
net buffer length 16,384
net read timeout 30
net retry count 10
net write timeout 60
new ON
old OFF
old alter table OFF
old passwords ON
open files limit 1,000,500
optimizer prune level 1
optimizer search depth 62
optimizer switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on
pid file /tmp/mysql.kyong.pid
plugin dir /data/mysql/kyong/lib/mysql/plugin
port 3,306
preload buffer size 32,768
profiling OFF
profiling history size 15
protocol version 10
pseudo thread id 565,879
(Global value) 0
query alloc block size 8,192
query cache limit 5,242,880
query cache min res unit 4,096
query cache size 52,428,800
query cache type ON
query cache wlock invalidate OFF
query prealloc size 8,192
rand seed1
rand seed2
range alloc block size 4,096
read buffer size 1,048,576
read only OFF
read rnd buffer size 262,144
relay log
relay log index
relay log info file relay-log.info
relay log purge ON
relay log space limit 0
report host
report password
report port 3,306
report user
rpl recovery rank 0
secure auth OFF
secure file priv
server id 46,140
skip external locking ON
skip networking OFF
skip show database OFF
slave compressed protocol OFF
slave exec mode STRICT
slave load tmpdir /tmp
slave net timeout 3,600
slave skip errors OFF
slave transaction retries 10
slow launch time 2
slow query log ON
slow query log file /dh/mysql/logs/mysql.kyong.slow
socket /dh/mysql/kyong/mysql.kyong.sock
sort buffer size 1,048,576
sql auto is null ON
sql big selects ON
sql big tables OFF
sql buffer result OFF
sql log bin ON
sql log off OFF
sql log update ON
sql low priority updates OFF
sql max join size 18446744073709551615
sql mode
sql notes ON
sql quote show create ON
sql safe updates OFF
sql select limit 18446744073709551615
sql slave skip counter
sql warnings OFF
ssl ca
ssl capath
ssl cert
ssl cipher
ssl key
storage engine MyISAM
sync binlog 0
sync frm ON
system time zone PDT
table definition cache 256
table lock wait timeout 50
table open cache 350
table type MyISAM
thread cache size 20
thread handling one-thread-per-connection
thread stack 196,608
time format %H:%i:%s
time zone SYSTEM
timed mutexes OFF
timestamp 1,274,350,444
tmp table size 16,777,216
tmpdir /tmp
transaction alloc block size 8,192
transaction prealloc size 4,096
tx isolation REPEATABLE-READ
unique checks ON
updatable views with limit YES
version 5.1.39-log
version comment MySQL Server
version compile machine i486
version compile os pc-linux-gnu
wait timeout 14,400
warning count 0
Subject
Views
Written By
Posted
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.