Search issue: Any search query shows ALL blog articles

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

Search issue: Any search query shows ALL blog articles

Post by Bernardo »

Hi,
the search on my blog is kinda messed up.
I encountered the "fulltext index" issue during the last days, but only if a search result had to be paged. The first page was normal, but when I clicked on page 2, it displayed this message:

Code: Select all

CREATE FULLTEXT INDEX entry_idx on serendipity_entries (title,body,extended)
I looked up the forum for a solution and contacted my provider afterwards who gave me the rights to add an index (which I did afterwards).

But now I seem to get ALL blog articles as a search result if i search for ANY word, i.e. "Test" or any other search term that definitely appears in one or more articles.

Any ideas how I can solve this?

Thanks in advance and best regards,
Bernardo
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Search issue: Any search query shows ALL blog articles

Post by garvinhicking »

Hi!

That sounds really odd; did you use phpmyadmin to create the index? Can you post a screenshot of your expanded "Structure" page of serendipity_entries?

Do you possible have static pages plugin enabled, or the comment search plugin? Both could maybe interfer with the search and produce an error result.

What is your URL?

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/
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

Re: Search issue: Any search query shows ALL blog articles

Post by Bernardo »

did you use phpmyadmin to create the index?
Yes, I did.
Can you post a screenshot of your expanded "Structure" page of serendipity_entries?
Done.
Do you possible have static pages plugin enabled, or the comment search plugin? Both could maybe interfer with the search and produce an error result.
Static pages plugin is enabled. I just disabled it to verify this, but the result stays the same.
What is your URL?
http://www.bernhard-runzheimer.de/blog

Thanks for your help.
Attachments
screenshot.gif
screenshot.gif (74.11 KiB) Viewed 8126 times
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Search issue: Any search query shows ALL blog articles

Post by garvinhicking »

Hi!

Thanks for the answers. Okay, so this is really weird. Do you know which MySQL Server version is being used? To me it seems as if fulltext matching is broken there.

Can you, in phpMyAdmin, please execute this query:

Code: Select all

SELECT id, title, body, extended, MATCH(title, body, extended) AGAINST ('Memento') AS weight FROM serendipity_entries WHERE MATCH(title, body, extended) AGAINST ('Memento') 
and see what that returns?

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/
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

Re: Search issue: Any search query shows ALL blog articles

Post by Bernardo »

Do you know which MySQL Server version is being used?
Server Version: 5.0.32-Debian_7etch6-log
Can you, in phpMyAdmin, please execute this query and see what that returns?
Gives exactly one result: The article on the front page about the film "Memento".

I also tested that query with another word which appears in more than one article. That also works fine.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Search issue: Any search query shows ALL blog articles

Post by garvinhicking »

Hi!

That is very odd. Which event plugins do you have installed exactly?

You could also, for a quick test, edit your inculde/functions_entries.inc.php file. Search for this string:

Code: Select all

    // DEBUG:
    // die($query);
and change that to:

Code: Select all

    // DEBUG:
    die($query);
Do that only temporarily, then F5/Refresh the request in your browser where you search for the entries, and you should get the exact SQL query getting executed, which we can analyze to see why all entries are queried instead of only the matching ones.

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/
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

Re: Search issue: Any search query shows ALL blog articles

Post by Bernardo »

Well, okay:

Code: Select all

 SELECT 
                    multilingual_body.value AS multilingual_body,
multilingual_extended.value AS multilingual_extended,
multilingual_title.value AS multilingual_title,


                    e.id,
                    e.title,
                    e.timestamp,
                    e.comments,
                    e.exflag,
                    e.authorid,
                    e.trackbacks,
                    e.isdraft,
                    e.allow_comments,
                    e.last_modified,

                    a.realname AS author,
                    a.username AS loginname,
                    a.email
                     
                     
                FROM
                    serendipity_entries AS e
                    LEFT JOIN serendipity_authors a
                        ON e.authorid = a.authorid
                    LEFT JOIN serendipity_entrycat ec
                        ON e.id = ec.entryid
                    LEFT JOIN serendipity_category c
                        ON ec.categoryid = c.categoryid
                    
LEFT OUTER JOIN serendipity_entryproperties multilingual_body
                                                 ON (e.id = multilingual_body.entryid AND multilingual_body.property = 'multilingual_body_de')
LEFT OUTER JOIN serendipity_entryproperties multilingual_extended
                                                 ON (e.id = multilingual_extended.entryid AND multilingual_extended.property = 'multilingual_extended_de')
LEFT OUTER JOIN serendipity_entryproperties multilingual_title
                                                 ON (e.id = multilingual_title.entryid AND multilingual_title.property = 'multilingual_title_de')
                     WHERE e.timestamp >= 1235862000 AND e.timestamp <= 1267484399 AND isdraft = 'false' AND e.timestamp <= 1330538700
                     GROUP BY e.id
                     
                     ORDER BY timestamp DESC
                      LIMIT 1
That's the only SELECT statement that appears in the code. It doesn't look like a "search" string, though, because there is no search keyword...but maybe you had something different in mind.

Installed event plugins (in order of appearance):

Code: Select all

serendipity_event_nl2br
serendipity_event_browsercompatibility
serendipity_event_spartacus
serendipity_event_staticpage
serendipity_event_randomblogdescription
serendipity_event_xmlrpc
serendipity_event_weblogping
serendipity_event_statistics
serendipity_event_spamblock
serendipity_event_spamblock_surbl
serendipity_event_emoticate
serendipity_event_kubrickheader
serendipity_event_multilingual
serendipity_event_google_sitemap
serendipity_event_lightbox
serendipity_event_layout_quotemarkup
serendipity_event_freetag
serendipity_event_trackback
serendipity_event_contactform
serendipity_event_geotag
serendipity_event_mobile_output
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

Re: Search issue: Any search query shows ALL blog articles

Post by Bernardo »

Sorry, I forgot to mention: The above SELECT statement obviously returns exactly ONE result...but you surely noticed that already ("LIMIT 1")...but just in case... :)
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Search issue: Any search query shows ALL blog articles

Post by garvinhicking »

Hi!

Maybe instead of "DIE" you can add a "echo $query" instead, so that you get all SQL queries performed on the page.

My bet currently is on the multilingual plugin possible interfering; can you temporarily disable it to see if it's the culprit?

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/
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

Re: Search issue: Any search query shows ALL blog articles

Post by Bernardo »

My bet currently is on the multilingual plugin possible interfering; can you temporarily disable it to see if it's the culprit?
Yup, that did it! :D

Garvin, many thanks for your patience and help!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Search issue: Any search query shows ALL blog articles

Post by garvinhicking »

Hi!

Okay. Do you want to use that plugin? If so, we could try to do some debugging together to find out why exactly the multilingual plugin is misbehaving.

In that case, I'd need the "echo $query" outputs of the whole search query, not only the first "LIMIT 1" one...

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/
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

Re: Search issue: Any search query shows ALL blog articles

Post by Bernardo »

Okay. Do you want to use that plugin? If so, we could try to do some debugging together to find out why exactly the multilingual plugin is misbehaving.
Hmm, well...I had it in use for about 2 articles, if I remember correctly...it sure wouldn't hurt to just deactivate it. Otherwise, it wouldn't be so bad to find out why that plugin doesn't work...maybe it's a common bug.

I'll post the $echo query later if that's okay for you.
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

Re: Search issue: Any search query shows ALL blog articles

Post by Bernardo »

Well, I just replaced the "debug" line with the "echo" line, reactivated the "multilingual plugin" and started another search...but the result (the SQL statement) stays the same as described above:

The search returns ALL blog articles. Moreover, no other SQL statements are visible in the sourcecode.
BUT...the statement shows up in the following sidebar plugin (instead of the older article that is normally placed there):

Code: Select all

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

Re: Search issue: Any search query shows ALL blog articles

Post by garvinhicking »

Hi!

Oh man, I'm terribly sorry. I told you the wrong place; the entry search is actually performed in the "serendipity_searchEntries()" function. There no "echo $query" thing is currently existing, so if you add this:

Code: Select all

echo "SEARCHQUERY: " . $querystring;
after this line:

Code: Select all

$search =& serendipity_db_query($querystring);
Best 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/
Bernardo
Regular
Posts: 37
Joined: Sat Jan 09, 2010 8:39 pm

Re: Search issue: Any search query shows ALL blog articles

Post by Bernardo »

:D
No problem. Sorry for the delay, though:

Code: Select all

SELECT 
                            multilingual_body.value AS multilingual_body,
multilingual_extended.value AS multilingual_extended,
multilingual_title.value AS multilingual_title,

                            e.id,
                            e.authorid,
                            a.realname AS author,
                            e.allow_comments,
                            e.moderate_comments,
                            a.email,
                            e.timestamp,
                            e.comments,
                            e.title,
                            e.body,
                            e.extended,
                            e.trackbacks,
                            e.exflag,
                            e.isdraft,
                            e.last_modified,
                            a.username AS loginname
                    
                      FROM
                            serendipity_entries e
                 LEFT JOIN  serendipity_authors a
                        ON  e.authorid = a.authorid
                 LEFT JOIN  serendipity_entrycat ec
                        ON  e.id = ec.entryid
                            
LEFT OUTER JOIN serendipity_entryproperties multilingual_body
                                                 ON (e.id = multilingual_body.entryid AND multilingual_body.property = 'multilingual_body_de')
LEFT OUTER JOIN serendipity_entryproperties multilingual_extended
                                                 ON (e.id = multilingual_extended.entryid AND multilingual_extended.property = 'multilingual_extended_de')
LEFT OUTER JOIN serendipity_entryproperties multilingual_title
                                                 ON (e.id = multilingual_title.entryid AND multilingual_title.property = 'multilingual_title_de')
                     WHERE
                            (MATCH(title,body,extended) AGAINST('memento') OR (
                                                         MATCH(multilingual_body.value)        AGAINST('memento' )
                                                         OR MATCH(multilingual_extended.value) AGAINST('memento' )
                                                         OR MATCH(multilingual_title.value)    AGAINST('memento' )
                                                       ))
                             AND isdraft = 'false'  AND timestamp <= 1330714800
                    GROUP BY e.id
                    
                  ORDER BY  timestamp DESC
                     LIMIT 7

Code: Select all

SELECT 
                            multilingual_body.value AS multilingual_body,
multilingual_extended.value AS multilingual_extended,
multilingual_title.value AS multilingual_title,

                            e.id,
                            e.authorid,
                            a.realname AS author,
                            e.allow_comments,
                            e.moderate_comments,
                            a.email,
                            e.timestamp,
                            e.comments,
                            e.title,
                            e.body,
                            e.extended,
                            e.trackbacks,
                            e.exflag,
                            e.isdraft,
                            e.last_modified,
                            a.username AS loginname
                    
                      FROM
                            serendipity_entries e
                 LEFT JOIN  serendipity_authors a
                        ON  e.authorid = a.authorid
                 LEFT JOIN  serendipity_entrycat ec
                        ON  e.id = ec.entryid
                            
LEFT OUTER JOIN serendipity_entryproperties multilingual_body
                                                 ON (e.id = multilingual_body.entryid AND multilingual_body.property = 'multilingual_body_de')
LEFT OUTER JOIN serendipity_entryproperties multilingual_extended
                                                 ON (e.id = multilingual_extended.entryid AND multilingual_extended.property = 'multilingual_extended_de')
LEFT OUTER JOIN serendipity_entryproperties multilingual_title
                                                 ON (e.id = multilingual_title.entryid AND multilingual_title.property = 'multilingual_title_de')
                     WHERE
                            (MATCH(title,body,extended) AGAINST('memento*' IN BOOLEAN MODE) OR (
                                                         MATCH(multilingual_body.value)        AGAINST('memento*'  IN BOOLEAN MODE)
                                                         OR MATCH(multilingual_extended.value) AGAINST('memento*'  IN BOOLEAN MODE)
                                                         OR MATCH(multilingual_title.value)    AGAINST('memento*'  IN BOOLEAN MODE)
                                                       ))
                             AND isdraft = 'false'  AND timestamp <= 1330714800
                    GROUP BY e.id
                    
                  ORDER BY  timestamp DESC
                     LIMIT 7
Search string is "Memento" again. If search succeeds (multilingual plugin deactivated), it gives back exactly one article. If it fails (multilingual plugin activated), it shows all currently available 749 articles.

The first statement returns an error:

Code: Select all

#1191 - Can't find FULLTEXT index matching the column list 
The second statement shows the first seven articles (due to the "LIMIT 7" part) instead of showing just one article where the keyword "Memento" was used.
Post Reply