Advanced search bug (related to phpbb-seo)

phpBB3 SEO Advanced mod Rewrite support forum.
This mods performs URL rewriting for phpBB, injecting forums and topic titles in their URLs.

Moderator: Moderators

Advanced search bug (related to phpbb-seo)

Postby golgoth » Sat Jun 14, 2008 6:33 pm

I just noticed that advanced search in my forum is not working properly: if i try to search inside a forum i get some random results picked from other sections.

After some tests, i saw that the code that causes the error is this replace in search.php:

Code: Select all
#
#-----[ FIND ]------------------------------------------
#

   $u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results);
   $u_search .= ($search_id) ? '&search_id=' . $search_id : '';
   $u_search .= ($u_hilit) ? '&keywords=' . urlencode(htmlspecialchars_decode($search->search_query)) : '';
   $u_search .= ($topic_id) ? '&t=' . $topic_id : '';
   $u_search .= ($author) ? '&author=' . urlencode(htmlspecialchars_decode($author)) : '';
   $u_search .= ($author_id) ? '&author_id=' . $author_id : '';
   $u_search .= ($u_search_forum) ? '&fid%5B%5D=' . $u_search_forum : '';
   $u_search .= (!$search_child) ? '&sc=0' : '';
   $u_search .= ($search_fields != 'all') ? '&sf=' . $search_fields : '';
   $u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : '';

#
#-----[ REPLACE, WITH ]------------------------------------------
#

   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   //$u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results);
   $u_search = $u_sort_param . $u_show_results;
   $u_search .= ($search_id) ? '&search_id=' . $search_id : '';
   $u_search .= ($u_hilit) ? '&keywords=' . urlencode(htmlspecialchars_decode($search->search_query)) : '';
   $u_search .= ($topic_id) ? '&t=' . $topic_id : '';
   $u_search .= ($author) ? '&author=' . urlencode(htmlspecialchars_decode($author)) : '';
   $u_search .= ($author_id) ? '&author_id=' . $author_id : '';
   $u_search .= ($u_search_forum) ? '&fid%5B%5D=' . $u_search_forum : '';
   $u_search .= (!$search_child) ? '&sc=0' : '';
   $u_search .= ($search_fields != 'all') ? '&sf=' . $search_fields : '';
   $u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : '';
   $u_search = trim($u_search, '&');
   if ( $phpbb_seo->seo_opt['rewrite_usermsg'] && (!empty($author) || !empty($author_id)) ) {
      $author_name = '';
      if (!empty($author_id)) {
         $sql = $sql = 'SELECT username
            FROM ' . USERS_TABLE . "
            WHERE user_id = $author_id
            AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
         $result = $db->sql_query($sql);
         if ($row = $db->sql_fetchrow($result)) {
            $author_name = $row['username'];
            $phpbb_seo->set_user_url( $author_name, $author_id );
         }
      }
      if (!empty($author) && (strpos($author, '*') === false) ) {
         $sql = $sql = 'SELECT user_id
            FROM ' . USERS_TABLE . "
            WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'
            AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')';
         $result = $db->sql_query($sql);
         if ($row = $db->sql_fetchrow($result)) {
            $phpbb_seo->set_user_url( $author, $row['user_id'] );
         }
      }
      $author = empty($author) ? $author_name : $author;
   }
   $u_search = append_sid( "{$phpbb_root_path}search.$phpEx" . (!empty($u_search) ? '?' . $u_search : '') );
   // www.phpBB-SEO.com SEO TOOLKIT END


Can you guys help me fixing it?

Thanks
golgoth
 
Posts: 19
Joined: Tue May 06, 2008 5:42 pm

Advertisement

Postby SeO » Sun Jun 15, 2008 12:32 pm

Before I look into this further, could you tell me, in case you are as well using the zero duplicate, if it does change something to deactivate it ?
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

Postby golgoth » Sun Jun 15, 2008 4:26 pm

I deactivated it, but i still get that error. Right now i restored the original code to get it work correctly.
golgoth
 
Posts: 19
Joined: Tue May 06, 2008 5:42 pm

Postby HB » Sun Jun 15, 2008 4:32 pm

Specifically what search options are you using (forum + keyword)? I just tried it on my forum and it works as expected.
Dan Kehn
HB
phpBB SEO Team
phpBB SEO Team
 
Posts: 1561
Joined: Mon Oct 16, 2006 2:25 am

Postby golgoth » Sun Jun 15, 2008 8:00 pm

I used a common word, "patch", and searched in a specifical forum (which has 3 subforums).

Right now in my site the search engine is working correctly because those lines of code haven't been added, but if you wish i'll add them so that you can see the problem with your own eyes.
golgoth
 
Posts: 19
Joined: Tue May 06, 2008 5:42 pm

Postby SeO » Sun Jun 15, 2008 9:22 pm

Ok, I'll take a look at this ;)
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

Postby golgoth » Sat Jun 21, 2008 10:48 pm

Any news?

By the way, im going to totally reinstall my forum, along with phpbb-seo.

Do i have to make some changes in order to make search engine works correctly (domain and forum path won't change) or do i simply need to rename (in SEO ACP) forum categories with the same names i did before?
golgoth
 
Posts: 19
Joined: Tue May 06, 2008 5:42 pm

Postby SeO » Sun Jun 22, 2008 9:18 am

You can keep all your settings by just keeping the phpbb_seo/cache/ content from your old install to your new one, this includes the forum custom urls.

Tell us if you still have the searching issue once done ;)
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

Postby golgoth » Sun Jun 22, 2008 11:13 am

Sure i will! I'll reinstall everything as soon as phpBB 3.0.2 will come out!
golgoth
 
Posts: 19
Joined: Tue May 06, 2008 5:42 pm

Postby golgoth » Sun Jun 22, 2008 5:47 pm

I forgot to ask: why do we have to wait a month or two to replace robots.txt?

I didn't understand the reason and i was curious :)
golgoth
 
Posts: 19
Joined: Tue May 06, 2008 5:42 pm

Postby remixed » Sat Jul 05, 2008 9:22 am

because google has your bad (not seo friendly) urls indexed first. The next time google visit your website he wil look at your robots.txt. If all bad (not seo friendly) urls are blocked google will delete all those urls and not directly replace it by the good urls (take some time for google). Which means that nobody visit your site anymore ;)
remixed
 
Posts: 19
Joined: Fri May 09, 2008 4:03 pm


Return to Advanced SEO URL

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 8 guests