Advertisement:

Author Topic: Search Enhancement Mod  (Read 191811 times)

Offline ioszilla

  • Jr. Member
  • **
  • Posts: 252
  • Gender: Male
  • Freedom to be unfree.
Re: SMF Search Enhancement Mod
« Reply #20 on: August 13, 2007, 01:55:42 PM »
Eleglin, it doesn't matter at all. And thanks for your translation :)

Offline Kirsten07734

  • Semi-Newbie
  • *
  • Posts: 40
Re: SMF Search Enhancement Mod
« Reply #21 on: August 13, 2007, 02:01:45 PM »
WOW!!!

I've wanted something like this for a very long time.  I hope they incorporate it in future releases of SMF.

I've installed it on my test forum without problem and LOVE it.  Now I'm off to see what my live forum thinks of it.

Thanks so much!!!

Offline Eleglin

  • Sr. Member
  • ****
  • Posts: 754
  • Gender: Male
    • Les Archives de Gondor
Re: SMF Search Enhancement Mod
« Reply #22 on: August 13, 2007, 02:04:39 PM »
Don't understand WHY there are two menus.
These are the classical menu + your menu.
Can we delete the classical one ?
No support by PM or Mail.

Offline ioszilla

  • Jr. Member
  • **
  • Posts: 252
  • Gender: Male
  • Freedom to be unfree.
Re: SMF Search Enhancement Mod
« Reply #23 on: August 13, 2007, 02:09:36 PM »
Don't understand WHY there are two menus.
These are the classical menu + your menu.
Can we delete the classical one ?

classical menu? my menu? Could you explain more plz? Thanks. :)

Offline ioszilla

  • Jr. Member
  • **
  • Posts: 252
  • Gender: Male
  • Freedom to be unfree.
Re: SMF Search Enhancement Mod
« Reply #24 on: August 13, 2007, 02:12:29 PM »
@ christicehurst:

I just visited your forum: http://www.writersmuster.com/ and I see quick search box is not working there (because you are not using the default smf theme)

I'll post instructions to manually modify your custom theme momentarily so you'll have the quick search box on the forum. :)

Offline Eleglin

  • Sr. Member
  • ****
  • Posts: 754
  • Gender: Male
    • Les Archives de Gondor
Re: SMF Search Enhancement Mod
« Reply #25 on: August 13, 2007, 02:18:36 PM »
Here

Don't understand the differences between :
* 2.  Match all words/Match any words
* 9.  Match Mode

I thought that 9 replaces 2, but I was wrong. Didn't I ?
No support by PM or Mail.

Offline ioszilla

  • Jr. Member
  • **
  • Posts: 252
  • Gender: Male
  • Freedom to be unfree.
Re: SMF Search Enhancement Mod
« Reply #26 on: August 13, 2007, 02:19:25 PM »
How to add quick search box to your Custom (non-default) SMF Theme

EDIT: Your_Theme_Dir/index.template.php

Operation 1

Find:

Quote
   echo '
            <td class="titlebg2" align="right" nowrap="nowrap" valign="top">
               <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
                  <a href="', $scripturl, '?action=search;advanced"><img src="'.$settings['images_url'].'/filter.gif" align="middle" style="margin: 0 1ex;" alt="" /></a>
                  <input type="text" name="search" value="" style="width: 190px;" />&nbsp;
                  <input type="submit" name="submit" value="', $txt[182], '" style="width: 11ex;" />
                  <input type="hidden" name="advanced" value="0" />';

   // Search within current topic?
   if (!empty($context['current_topic']))
      echo '
                  <input type="hidden" name="topic" value="', $context['current_topic'], '" />';

      // If we're on a certain board, limit it to this board ;).
   elseif (!empty($context['current_board']))
      echo '
                  <input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';

   echo '
               </form>
            </td>
         </tr>
      </table>
   </div>';


Replace with:

Quote
   echo '
            <td class="titlebg2" align="right" nowrap="nowrap" valign="top">
               <form action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '" style="margin: 0;">
                  <a href="', $scripturl, '?action=search;advanced"><img src="'.$settings['images_url'].'/filter.gif" align="middle" style="margin: 0 1ex;" alt="" /></a>
                  <input type="text" name="search" value="" style="width: 190px;" />&nbsp;';
   
   echo DropDownQuickSearch();

   echo            '<input type="submit" name="submit" value="', $txt[182], '" style="width: 11ex;" />
                  <input type="hidden" name="advanced" value="0" />';

   // If we're viewing a single topic
   if (!empty($context['current_topic']))
      echo '
                  <input type="hidden" name="acttopic" value="', $context['current_topic'], '" />';

   // If we're on a certain board
   if (!empty($context['current_board']))
      echo '
                  <input type="hidden" name="actbrd" value="', $context['current_board'], '" />';

   echo '
               </form>
            </td>
         </tr>
      </table>
   </div>';



Operation 2

ADD the following code to the END of the file (but before the ending ?> ):

Quote
function DropDownQuickSearch ()
{
   global $context, $txt;

   // in order!!
   $Selections = array(
      'entireforum' => $txt['search_entireforum'],
      'thisbrd' => $txt['search_thisbrd'],
      'thistopic' => $txt['search_thistopic'],
      'members' => $txt['search_members'],
      // Google site search
      'entiresite' => $txt['search_entiresite']
   );

   $default = 'entireforum';
      
   if (empty($context['current_topic']))
      unset ($Selections['thistopic']);

   if (empty($context['current_board']))
      unset ($Selections['thisbrd']);
   
   $str = '
   <select name="search_selection">';
   
   foreach ($Selections as $selection => $title)
      $str .= '
         <option value="' . $selection . '"' . ($selection == $default ? ' selected="selected"' : '') . '>' . $title . ' </option>';
   
   $str .= '
   </select>&nbsp;';
   
   return $str;
}
« Last Edit: August 13, 2007, 02:23:24 PM by wordzilla »

Offline ioszilla

  • Jr. Member
  • **
  • Posts: 252
  • Gender: Male
  • Freedom to be unfree.
Re: SMF Search Enhancement Mod
« Reply #27 on: August 13, 2007, 02:30:16 PM »
Here

Don't understand the differences between :
* 2.  Match all words/Match any words
* 9.  Match Mode

I thought that 9 replaces 2, but I was wrong. Didn't I ?

2 is about 'Match What', and 9 is about 'How it matches'.

Read the descriptions in the guide carefully. :)

Offline christicehurst

  • Full Member
  • ***
  • Posts: 581
  • Gender: Male
  • Brisbane Lions United Admin
    • CJT Online
Re: SMF Search Enhancement Mod
« Reply #28 on: August 13, 2007, 02:58:30 PM »
@ christicehurst:

I just visited your forum: http://www.writersmuster.com/ and I see quick search box is not working there (because you are not using the default smf theme)

I'll post instructions to manually modify your custom theme momentarily so you'll have the quick search box on the forum. :)

That's alright thanks. Now dealing with how SEO 4 SMF stuffed my forum up. Sadly not all mods are like yours!
www.brisbanelionsunited.com - A forum for everyone!

Offline dcmouser

  • Jr. Member
  • **
  • Posts: 208
    • donationcoder.com
Re: SMF Search Enhancement Mod
« Reply #29 on: August 13, 2007, 03:40:59 PM »
Congratulations on sharing this mod -- I know it was quite a bit of work to make it into a package and document everything.
proud member of donationcoder.com (forum)

Offline Eleglin

  • Sr. Member
  • ****
  • Posts: 754
  • Gender: Male
    • Les Archives de Gondor
Re: SMF Search Enhancement Mod
« Reply #30 on: August 13, 2007, 04:00:16 PM »
Well, I have understand. Yeaaaaaaaaaah !  :P

Code: [Select]
<file name="$languagedir/Modifications.french.php">
<operation>
<search position="end" />
<add><![CDATA[
//Begin DC SMF Search Text Strings
$txt['specific_topic_id'] = 'ID d\'un topic spécifique';
$txt['search_match_mode'] = 'Mode de correspondance';
$txt['search_match_mode_whole'] = 'Exacte - moins de résultats, peu de bruits';
$txt['search_match_mode_smart'] = 'Avec troncature - option intermédiaire';
$txt['search_match_mode_any'] = 'Toute correspondance - plus de résultats, plus de bruits';

$txt['search_numReplies'] = 'Réponses';
$txt['search_match_mode_whole_short'] = 'et de façon exacte';
$txt['search_match_mode_smart_short'] = 'avec troncature';
$txt['search_match_mode_any_short'] = 'et quelque soit la forme';

$txt['result_summary'] = 'Montrer/cacher la synthèse des résultats';

$txt['result_generated'] = 'Résultats générés par';
$txt['zillarank'] = 'ZillaRank';

$txt['search_entireforum'] = 'dans tout le forum';
$txt['search_thisbrd'] = 'dans cette section';
$txt['search_thistopic'] = 'dans ce fil';
$txt['search_members'] = 'parmi les membres';
$txt['search_entiresite'] = 'dans tout le site';
//END DC SMF Search Text Strings
]]></add>
</operation>
</file>



There are some things we can't directly translate in search.template.php :
Code: [Select]
$num_matches_link = $topic['num_matches'] > 1 ? '<a title="View all ' . $topic['num_matches'] . ' posts in this topic that match your search criteria"' . ' href="' . $scripturl . '?action=search2;params=' . $context['params'] . ';topic_search=1;acttopic=' . $topic['id'] . '">&nbsp;' . $topic['num_matches'] . ' </a>' : $topic['num_matches'] . ' ';
View all XXXXXXXXXXXXXX posts in this topic that match your search criteria =  Voir les XXXXXXXXXXX messages dans ce topic correspondant à ces critères de recherche (french)

Also here, in the same file, I thought that you could replace this
Code: [Select]
echo DropDownReviseSearch();

echo ' by&nbsp;user:&nbsp;<input type=

by that :
Code: [Select]
echo DropDownReviseSearch();

echo ''. $txt[583] .':&nbsp;<input type=
No support by PM or Mail.

Offline ioszilla

  • Jr. Member
  • **
  • Posts: 252
  • Gender: Male
  • Freedom to be unfree.
Re: SMF Search Enhancement Mod
« Reply #31 on: August 13, 2007, 04:06:15 PM »
Eleglin, thx!! Damn hard coded English strings. Mea culpa. Fixing now..

Offline ioszilla

  • Jr. Member
  • **
  • Posts: 252
  • Gender: Male
  • Freedom to be unfree.
Re: SMF Search Enhancement Mod
« Reply #32 on: August 13, 2007, 04:38:01 PM »
@Eleglin: new mod uploaded, with your latest French translation. Sorry I really meant to remove all hard-coded English strings. :)

Note: this update only deals with translation, English forum owners do not have to upgrade at all.

Offline ioszilla

  • Jr. Member
  • **
  • Posts: 252
  • Gender: Male
  • Freedom to be unfree.
Re: SMF Search Enhancement Mod
« Reply #33 on: August 13, 2007, 04:51:09 PM »
@Eleglin: does the search rank results well on your French forum? I would assume so but couldn't confirm it myself as I only run English forum. :)

Offline Ben_S

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,727
  • xxx
Re: SMF Search Enhancement Mod
« Reply #34 on: August 13, 2007, 07:51:16 PM »
Surely ranking is subjective, personally as far as I can see, the only relativeness a machine can provide is that of ordering by date?
Liverpool FC Forum with 14 million+ posts.

Offline L.G.S

  • SMF Hero
  • ******
  • Posts: 2,658
  • Gender: Male
  • RuthlessIntent.com !
    • GamesandGoals.com
Re: SMF Search Enhancement Mod
« Reply #35 on: August 13, 2007, 09:17:49 PM »
I got errors in package manager for Search.php and index.template.php.

I can sort index.template.php just fine but the large amount of changes in Search.php and where they are, are really confusing me. Would you mind modifying my file please?

FREE and LIVE World Cup + Premier League football streams:

www.gamesandgoals.com


Offline dcmouser

  • Jr. Member
  • **
  • Posts: 208
    • donationcoder.com
Re: SMF Search Enhancement Mod
« Reply #36 on: August 13, 2007, 09:27:25 PM »
The trouble with the package manager being able to find and replace things is exactly why i complained so much about SMF's refusual to allow us mod makers to include the modified source files to make it easier for people to manuall make changes if they prefer.

Wordzilla is a much nicer person than me so he bent over backwards to create this in package manager form, but i still hope the smf admins will reconsider their policy of outlawing mod makers from including a few modified source code files in their modification packages for those who have troubles with the package installer.
proud member of donationcoder.com (forum)

Offline ioszilla

  • Jr. Member
  • **
  • Posts: 252
  • Gender: Male
  • Freedom to be unfree.
Re: SMF Search Enhancement Mod
« Reply #37 on: August 13, 2007, 10:50:16 PM »
I got errors in package manager for Search.php and index.template.php.

I can sort index.template.php just fine but the large amount of changes in Search.php and where they are, are really confusing me. Would you mind modifying my file please?

I just compared the search.php in your attachment with official 1.1.3 search.php and I saw a few mod changes there that caused package installer to fail.

You have View Any Topic Permission and Remove Hidden Text mods installed, and the former is what prevented you from installing my mod.

Lines #1374-1394 from your search.php:

Quote
   // View Any Topic Permission
   $request = db_query("
      SELECT b.ID_BOARD
      FROM {$db_prefix}boards AS b", __FILE__, __LINE__);
   $normal_boards = array(-1);
   while ($row = mysql_fetch_assoc($request)) {
      if (allowedTo('view_any_topic', $row['ID_BOARD']))
         $normal_boards[] = $row['ID_BOARD'];
   }
   mysql_free_result($request);

   $participants = array();
   $request = db_query("
      SELECT " . (empty($search_params['topic']) ? 'lsr.ID_TOPIC' : $search_params['topic'] . ' AS ID_TOPIC') . ", lsr.ID_MSG, lsr.relevance, lsr.num_matches
      FROM {$db_prefix}log_search_results AS lsr, {$db_prefix}topics AS t, {$db_prefix}messages AS mf
      WHERE ID_SEARCH = " . $_SESSION['search_cache']['ID_SEARCH'] . "
         AND t.ID_TOPIC = lsr.ID_TOPIC
         AND mf.ID_MSG = t.ID_FIRST_MSG
         AND ( t.ID_BOARD IN (" . implode(', ', $normal_boards) . ") OR t.isSticky = 1 OR mf.ID_MEMBER = $ID_MEMBER )
      ORDER BY $search_params[sort] $search_params[sort_dir]
      LIMIT " . (int) $_REQUEST['start'] . ", $modSettings[search_results_per_page]", __FILE__, __LINE__);

Offline ioszilla

  • Jr. Member
  • **
  • Posts: 252
  • Gender: Male
  • Freedom to be unfree.
Re: SMF Search Enhancement Mod
« Reply #38 on: August 13, 2007, 11:55:42 PM »
Surely ranking is subjective, personally as far as I can see, the only relativeness a machine can provide is that of ordering by date?

Yes ranking/relevance is subjective, but fortunately IMO there are also quite a few objective and reliable ways to measure relevance (e.g. keyword concentration, frequency of matching posts). From what I've seen on DonationCoder.com forum, the new search has dramatically improved ranking and is saving everybody's time.

I don't know if you share my experience (maybe not), but when I used to do forum search on DonationCoder.com, more than often I looked at the top results and "WTF?" - now I do search, look at first 10 results, find exactly what I wanted to see and I'm happy. In my opinion that's how 'relevance' should be defined.


Search ranking is especially important for BIG forums like the one you run, Ben_S - frequently your users get overwhelming amount of matches (it's reasonable to assume that only a small fraction of ppl today are very good at crafting queries). Now with "ordering by date" or otherwise poorly ranked results, it's impossible for users to grab the whole picture and enjoy the richness of information -- their horizon is strictly limited to recent posts and irrelevant posts, and as such it makes no difference whether the forum boasts 3 million posts or has just 30k. Yes, the admin and his forum users can swear that there's 500% chance the topic of interest just lies somewhere, somewhere, somewhere, buried in 3 million posts -- yet nobody is willing to go through 30 pages of search results to dig it out. Dang! It's lost.

Without a most effective search ranking system, the frustrations of people who do search on the forum grow just as the forum itself grows - they search, they are constantly bombarded by irrelevant info (i.e. crap), they lose patience, they don't find anything, and eventually they don't bother to search at all.

« Last Edit: August 14, 2007, 12:16:20 AM by wordzilla »

Offline ioszilla

  • Jr. Member
  • **
  • Posts: 252
  • Gender: Male
  • Freedom to be unfree.
Re: SMF Search Enhancement Mod
« Reply #39 on: August 14, 2007, 08:51:09 AM »
is this alot more server intensive than the standard smf one?

The mod is working on L.G.S's Ruthless Intent forum, searching 134,078 Posts in 67,934 Topics. And to my knowledge he's not on a dedicated server.

As you can see this mod searches big forums with ease. :)