Does search works in the recent cvs?

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
skyroam
Regular
Posts: 13
Joined: Sat Dec 11, 2004 1:11 am

Does search works in the recent cvs?

Post by skyroam »

I can't search anything in my serendipity generally.
But sometimes I found that a few things can be searched ! :?:
What should I do to make search works well always? Thank you very much!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Does search works in the recent cvs?

Post by garvinhicking »

When does the search work and when not? You need to use words longer than 3 characters and pay attention to special characters.

There are a few threads on this forum about missing MySQL fulltext keys, maybe you search them up and see if your keys are correct. But then again, if your search works "sometimes", that can't be the case.

Need more input. :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Tom - Daai Tou Laam
Regular
Posts: 15
Joined: Thu Jan 06, 2005 1:34 am
Location: Hong Kong
Contact:

Post by Tom - Daai Tou Laam »

Is there a reason that the search is case sensitive? I haven't spent much time looking through the source to find the relevent code for this. Is it database dependent?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

At least on mysql the search is case insensitive. I don't know about the other database types...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
skyroam
Regular
Posts: 13
Joined: Sat Dec 11, 2004 1:11 am

Re: Does search works in the recent cvs?

Post by skyroam »

garvinhicking wrote:When does the search work and when not? You need to use words longer than 3 characters and pay attention to special characters.

There are a few threads on this forum about missing MySQL fulltext keys, maybe you search them up and see if your keys are correct. But then again, if your search works "sometimes", that can't be the case.

Need more input. :)

Regards,
Garvin
I do input words longer than 3 characters otherwise it will
give me some infomation that let me do like this. :D
I failed either in english or chinese words .
And the search still failed even after I installed a fresh
serendipity in default language (english) with all enries created in english.

Yeah,I got a error like this for the first search:

Code: Select all

The search function did not work as expected. Notice for the administrator of this blog: This may happen because of missing index keys in your database. On MySQL systems your database user account needs to be privileged to execute this query:

CREATE FULLTEXT INDEX entry_idx on serendipity_entries (title,body,extended)

The specific error returned by the database was:

SELECT 
                            e.id,
                            e.author,
                            a.username,
                            a.email,
                            ec.categoryid,
                            e.timestamp,
                            e.comments,
                            e.title,
                            e.body,
                            e.extended,
                            e.trackbacks,
                            e.exflag
                    
                      FROM
                            serendipity_entries e
                 LEFT JOIN  serendipity_authors a
                        ON  e.authorid = a.authorid
                 LEFT JOIN  serendipity_entrycat ec
                        ON  e.id = ec.entryid
                            
                     WHERE
                            MATCH(title,body,extended) AGAINST('Test')
                             AND isdraft = 'false'  AND timestamp <= 1105601476
                    GROUP BY e.id
                  ORDER BY  timestamp DESC
                     LIMIT 15

 / Can't find FULLTEXT index matching the column list
I do not know how to do .So I do a silly thing(maybe some
mistakes from the real operation,little knowing of mysql):

Code: Select all

mysql>grant CREATE FULLTEXT INDEX entry_idx on serendipity_entries to seuser@localhost 
Then errors disappeared.But I haven't searched anything just
as before.
What should I do ?
And I remembered that I use "grant all privileges on serendipity.* to .." to create serendipity database.
Why is there privileges with index still?

Thank you for your help!
Then I will search these topics with missing fulltex keys again.

:lol:
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Does search works in the recent cvs?

Post by garvinhicking »

Hi skyroam!

You are near to the solution. But the serendipity error messages said nothing that you should use a "GRANT" statement. Just use what you entered without 'grant' and it should work.

:)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
skyroam
Regular
Posts: 13
Joined: Sat Dec 11, 2004 1:11 am

Post by skyroam »

Thank you very much, garvinhicking.
I read more articles about it then before,and I knew
that I have partly break the rule "search before ask".

Then I spend some time to test .But I failed again.
Hope what I will type below do not break the rule. :D

I have just install the latest cvs(s9y_200501141338.tar.gz)
then I do like before(I have do a wrong copy with mysql command that i have done before,sorry for bother you!).

Code: Select all

mysql -useuser -p se
mysql>CREATE FULLTEXT INDEX entry_idx on serendipity_entries (title,body,extended);
mysql give"error 0,warning 0"
I am using mysql in gentoo linux,
here is the information about version and compiling:

Code: Select all

emerge -pv mysql
dev-db/mysql-4.0.23  +berkdb -debug -innodb +perl +readline (-selinux) +ssl -static -tcpd 0 kB 
Then I got "No entry found" result.
But after a few minutes(I only switched language between english and chinese during this time) ,I can search english text!

Unfortunately,the same problems appeared.Some of Chinese
chars and english chars can't be searched!
for english example:

Code: Select all

example
This is a example to be searched!
Here is the content.:D
I can search this entry by key with "searched" or "content",
such as:
"be searched"
"is the content"
.
I guess that space means "or" to search.

On the other examples,not the last word can be searched:

Code: Select all

 My new test for it.hehe
This entry can be searched by "test"!

Only word more than three chars can be indexed to be searched?
No, I can't search the first example entry("This is a example to be searched!") with key "example"!
I am puzzled.
And I can find nothing regular when I searche chinese.

What should I do to let all of the entried can be searched
by any string longer than 3 chars and no time relay?
Tom - Daai Tou Laam
Regular
Posts: 15
Joined: Thu Jan 06, 2005 1:34 am
Location: Hong Kong
Contact:

Post by Tom - Daai Tou Laam »

garvinhicking wrote:At least on mysql the search is case insensitive. I don't know about the other database types...

Regards,
Garvin
It is case sensitive using Postgresql.
Guest

Post by Guest »

Found the code:
In functions_entries.inc.php

Code: Select all

 if (strtolower($serendipity['dbType']) == 'postgres') {
        $group     = '';
        $distinct  = 'DISTINCT';
        $find_part = "(title~'$term' OR body~'$term' OR extended~'$term')";
    }
To make this case sensitive replace ~ with ~*, so it would be:

Code: Select all

 if (strtolower($serendipity['dbType']) == 'postgres') {
        $group     = '';
        $distinct  = 'DISTINCT';
        $find_part = "(title~*'$term' OR body~*'$term' OR extended~*'$term')";
    }
Post Reply