Forum Moderators: coopster

Message Too Old, No Replies

per site settings for MYSQL on virtual host

can a set-variable be used for one user?

         

amznVibe

5:53 am on Nov 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Mysql has a default text search option that is very poor, where it ORs words when most other searches use ANDs. It has the ability to change this behavior using

set-variable = ft_boolean_default='AND'

which goes into my.cnf

But on a virtual host you can't effect that for just one site can you? I think that has to be done server-wide and it might affect other sites.

It's hard to find documentation on this but I happened to find this:

MySQL reads default options from the following files on Unix:

Filename Purpose
--------------------------------------------
/etc/my.cnf Global options
DATADIR/my.cnf Server-specific options
~/.my.cnf User-specific options

Seems like its similar the inherited behavior for directives with htaccess. If this is possible, where would I put "my.cnf" on a virtual site?

(I am starting to think WebMasterworld could use a seperate MYSQL forum ;) )

coopster

11:53 am on Nov 28, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



That's a good question, amznVibe, and am looking forward to this discussion. Not to get off-topic, but can you SET [mysql.com] the variable before script execution? I've never tried this, but thought you might want to be the lab rabbit ;) :

$sql = "SET ft_boolean_default='AND'";
//$result = mysql_query($sql);
if (mysql_errno()) echo "MySQL error ".mysql_errno().": ".mysql_error();
// Run search query now...

ikbenhet1

12:08 pm on Nov 28, 2003 (gmt 0)

10+ Year Member




I'd like to know too.

amznVibe, i take it you mean fulltext search, is it an option to use "in boolean mode"?

select * from x where match('field') against('hi', 'there');
would become
select * from x where match('field') against('+hi +there' IN BOOLEAN MODE);

I know this was not the question, but maybe it helps, i'd like to know the anwer to this question too.

amznVibe

1:29 pm on Nov 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



(ikbenhet1, yes it's for IN BOOLEAN MODE but its not a query instruction)

When I try to do:

$sql = "SET ft_boolean_default='AND'"; 
$result = mysql_query($sql) or die("error - ".mysql_error());

I get:

error - Unknown system variable 'ft_boolean_default'

this page: [mysql.com...]
says "It is also possible to change most variables with the SET statement."

so I guess it's one that can't be changed that way...

Unfortunately it's not well documented... sure would be handy though.

amznVibe

1:45 pm on Nov 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You know what, this isn't yet a feature, my sincere apologies.

I thought it was, but its just a feature suggestion that was poorly stated.
After careful re-reading, I noticed the word "would" which implies its not yet.

amznVibe

8:43 pm on Nov 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another setting I have found that cannot be set during runtime is 'ft_min_word_len' which is an incredibly fustrating limitation on a virtual host.

Default is 4, and I want it down to 3, so words like "sky" "cat" and "fat" can be selected or filtered in or out. 2 would be too low, but 4 is too high. Sigh, why did they do that!