Advertisement:

Author Topic: Search Enhancement Mod  (Read 191622 times)

Offline sangham.net

  • Full Member
  • ***
  • Posts: 497
  • Gender: Male
Re: Search Enhancement Mod
« Reply #420 on: May 02, 2013, 02:56:52 AM »
Dear SMF friends and supporters,

I have some, maybe naive questions.

Is this mode the same, the SMF-forum here uses?
Would it search within TPortal articles as well?
Would, if work proper on SMF 2.0.4?

Thanks a lot in advanced!

« Last Edit: May 02, 2013, 03:12:39 AM by Johann B »

Offline NekoJonez

  • Full Member
  • ***
  • Posts: 503
  • Gender: Male
  • Stuff
    • @NekoJonez on Twitter
    • My blog
Re: Search Enhancement Mod
« Reply #421 on: May 07, 2013, 10:08:57 AM »
This mod doesn't work on my other themes.
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

Offline FragaCampos

  • Sophist Member
  • *****
  • Posts: 1,359
  • Gender: Male
    • docsPT
Re: Search Enhancement Mod
« Reply #422 on: May 20, 2013, 07:53:30 PM »
1. It's not the same. It's better. (It doesn't miss results)
2. I don't think so, maybe you should ask in the TP mod's page.
3. Yes. Although not as well as in 1.1x (some minor bugs like the one pointed out by TourFL and no different layout in results page)

Dear SMF friends and supporters,

I have some, maybe naive questions.

Is this mode the same, the SMF-forum here uses?
Would it search within TPortal articles as well?
Would, if work proper on SMF 2.0.4?

Thanks a lot in advanced!



Offline sangham.net

  • Full Member
  • ***
  • Posts: 497
  • Gender: Male
Re: Search Enhancement Mod
« Reply #423 on: May 20, 2013, 08:57:55 PM »
Thanks for your care and answers, FragaCampos.


Offline GL700Wing

  • Sr. Member
  • ****
  • Posts: 701
  • Gender: Female
Re: Search Enhancement Mod
« Reply #424 on: June 08, 2013, 05:33:49 AM »
Excuse me.How to make this mod to work as follow?
When someone enter any topic, the search filter will changes to "This topic" automatically.
I already find how to do this.Just do as follow.

I've spent ages today trying to work out how to get the search focus for this mod to be contextual (ie, if a board is selected change the default search to 'This board" and if a topic is selected change the default search to 'This topic" AND only show 'This board' and/or 'This topic' when relevant).  I finally worked out to do it and, when I searched this topic yet again (and knowing what to search for), I was amazed to discover that knarf32222 worked out how to do the same thing almost five years ago!

IMHO the following minor change adds incredible value to this mod (version 1.8.x)!!

In ./Themes/default/index.template.php
Find

Code: [Select]
if (empty($context['current_topic']))
unset ($Selections['thistopic']);

if (empty($context['current_board']))
unset ($Selections['thisbrd']);
Replace with
Code: [Select]
if (empty($context['current_board']))
unset ($Selections['thisbrd']);
else $default = 'thisbrd';

if (empty($context['current_topic']))
unset ($Selections['thistopic']);
else $default = 'thistopic';
Life doesn't have to be perfect to be wonderful ...

Offline Hristo

  • Jr. Member
  • **
  • Posts: 319
  • Gender: Male
Re: Search Enhancement Mod
« Reply #425 on: July 09, 2013, 06:35:02 PM »
Thanks the author for this very useful mod and thanks to GL700Wing & knarf32222 for the addition!

Here is another small addition which is useful for me - guests can search the site only with google (the other options are available only for members):

Before the mod is installed find in mod's install-2.0.xml file, or if the mod is already installed find in index.template.php:

Code: [Select]
$default = 'entireforum';

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

if (empty($context['current_board']))
unset ($Selections['thisbrd']);

Replace with:

Code: [Select]
if ($context['user']['is_guest']){
$default = 'entiresite';
unset ($Selections['entireforum'], $Selections['thisbrd'], $Selections['thistopic'], $Selections['members']);}

else {
$default = 'entireforum';

if (empty($context['current_board']))
unset ($Selections['thisbrd']);
else $default = 'thisbrd';

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


Offline FragaCampos

  • Sophist Member
  • *****
  • Posts: 1,359
  • Gender: Male
    • docsPT
Re: Search Enhancement Mod
« Reply #426 on: July 19, 2013, 02:58:55 PM »
I've been testing this mod (2.0.4 hack) for the last 3 months or so and I found it has some problems finding some results. Is there anyone interested in bettering this mod?
One of the problems is this one, already referred by spiros.

PS: Don't get me wrong, but I still don't understand why the SMF search system isn't better than it actually is.  :-\

Offline TourFL

  • Semi-Newbie
  • *
  • Posts: 73
Re: Search Enhancement Mod
« Reply #427 on: April 28, 2014, 04:38:01 AM »
Hello!
I hope this mod is still supported, it's a great tool for the forum  ;)

I have regularly an SQL error in my logs, but I couldn't reproduce it myself. I don't even know if the users got an error or if it was transparent. Hope you have an idea!

I'll try to ask the member if he remembers what he searched for.

Here is the log:

Code: [Select]
http://mysite/index.php?action=search2

Database Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1 ELSE 30 / (t.num_replies + 1) END +
25 * CASE WHEN t.id_last_msg < 587' at line 7


INSERT IGNORE INTO smf_log_search_results
(id_search, id_topic, relevance, id_msg, num_matches)
SELECT
177,
t.id_topic,
1000 * ((
CASE WHEN t.num_replies < 4 AND NOT (t.is_sticky = 1 AND t.locked = 1) THEN 30 * 0,1 ELSE 30 / (t.num_replies + 1) END +
25 * CASE WHEN t.id_last_msg < 58742 THEN 0 ELSE (t.id_last_msg - 58742) / 25176 END +
30 * CASE WHEN t.num_replies < 200 THEN t.num_replies / 200 ELSE 1 END +
30 +
30 * t.is_sticky
) / 100 * (1 - 0) + 0) * CASE WHEN t.locked = 1 AND t.is_sticky = 0 THEN 0.8 ELSE 1 END AS relevance,
t.id_first_msg,
1
FROM smf_topics AS t
INNER JOIN smf_tmp_log_search_topics AS lst ON (lst.id_topic = t.id_topic)
LIMIT 1159Fichier: /home/www/xxxxx/web/Sources/DCSearch.php

Line: 1944

I use SMF 2.0.4

Thanks!
I went a bit further in my investigation. Apparently, the problem comes from "THEN 30 * 0,1 ELSE 30 ": the "0,1" is not recognised, and should be replaced by "0.1"
That value comes from the "topic_without_enough_replies_penalty" vaiable set to "0.1". I'm not SQL and PHP expert  :-\ Is there a way to have SQL accepting the dot as a float separator, or should I change the dots by commas in the DCSearch.php file (from line 302 to 308)? Not sure of the impact...

Thanks for any help!
If you like Fiat 500 and derived models, the SMF forum I'm helping with: www.500-126.com

Offline TourFL

  • Semi-Newbie
  • *
  • Posts: 73
Re: Search Enhancement Mod
« Reply #428 on: September 14, 2015, 07:37:20 AM »
I think I solved it, so I give the result if anyone has the same problem.
I may be wrong, but it appears to come from some local server settings (my service provider is in Switzerland) considering the float separator as "," and not ".", so the problem might not appear in some other countries. SQL doesn't accept the comma as number separator, and queries are generating errors.

All changes are done in DCSearch.php
As the code just inserts those floats in a SQL request (which is a string), they don't need to be explicitly declared as float.
My solution is to force as string the float variables causing problem. I obviously checked that those variables are not use in some computation before  ;) (for example: $fulltext_score_ratio is used for computation and shall not be modified)

From line 300:
Code: [Select]
$fuzzy_min_length = 2; // min length of search word to allow RLIKE query
$active_board_scoring_heuristic_enabled = true; // Rank higher matching topics within the forum the user is browsing?
$non_active_board_multiplier = '0.75';    // if searchin a specific board, give less weight to search finds on other boards
$fulltext_score_ratio = 0.4;  // ?
$short_message_threshold = 600;  // characters of a short and therefore less relevant message
$non_subject_plus_body_double_matching_multiplier = '0.75'; // less relevance to topics that don't have the seach term in the subject
$topic_without_enough_replies_penalty = '0.1'; // 0 = harshest, 1 = do not penalize
$topic_without_enough_replies_threshold = 4; // minimum number of replies the topic should have to fairly claim award for "Number of matching messages within a topic"
$locked_topic_penalty = '0.8';  // penalize topics that are locked, set to 1 to disable penalty
$max_non_content_analysis_subject_keywords_evaluated = 4; // maximum number of valid subject words to search on
$max_non_content_analysis_compensation_ratio = $fulltext_score_ratio;

Then everywhere those variables are used, I modify the code this way (maybe not necessary): every time those are inside SQL queries declared as "float:variable_name", I replace by a concatenation of the php variable.

Example, line 1832
old code:
Code: [Select]
[...] CASE WHEN lst.id_topic IS NULL THEN {float:non_subject_plus_body_double_matching_multiplier} ELSE 1 END [...]

New code
Code: [Select]
[...]  CASE WHEN lst.id_topic IS NULL THEN ' .$non_subject_plus_body_double_matching_multiplier. ' ELSE 1 END [...]

This has to be done in many places in the source code (search for all the variables which have been modified).

Search engine still works fine, and I don't have anymore SQL errors since 2 weeks.
If necessary, I can provide my modified "DCSearch.php" file, but as explained before, I'm not an SQL expert, so there might be a better way to do this!

Hope this help  :)
If you like Fiat 500 and derived models, the SMF forum I'm helping with: www.500-126.com

Offline mountain90

  • Newbie
  • *
  • Posts: 1
Re: Search Enhancement Mod
« Reply #429 on: November 02, 2015, 10:51:33 PM »
Thank FragaCampos so much... :)

Offline crazyASD

  • Semi-Newbie
  • *
  • Posts: 23
Re: Search Enhancement Mod
« Reply #430 on: March 30, 2016, 08:51:33 PM »
Some stupid question. Where is  DCSearch_v1.8.2_SMF2.zip for SMF 2.x?

Offline TourFL

  • Semi-Newbie
  • *
  • Posts: 73
Re: Search Enhancement Mod
« Reply #431 on: March 31, 2016, 05:11:11 AM »
It works for me with 2.0.11, I suppose you can try installing the current version with the compatibility mode.
If you like Fiat 500 and derived models, the SMF forum I'm helping with: www.500-126.com

Offline FragaCampos

  • Sophist Member
  • *****
  • Posts: 1,359
  • Gender: Male
    • docsPT
Re: Search Enhancement Mod
« Reply #432 on: July 01, 2016, 05:30:13 PM »
Hi there.

A few weeks ago my log registry started showing hundreds of errors from this mod.

Here it is the errors that I'm getting:
Code: [Select]
8192: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
File: Sources/DCSearch.php

I've read some things about the php versions and this obsolete function, but would it be possible to correct it and still use this mod?


Offline 1.1Nerd

  • Semi-Newbie
  • *
  • Posts: 95
Re: Search Enhancement Mod
« Reply #433 on: January 17, 2021, 09:49:12 AM »
Does anybody know if this mods works with SMF 2.0.17?

Offline 1.1Nerd

  • Semi-Newbie
  • *
  • Posts: 95
Re: Search Enhancement Mod
« Reply #434 on: January 17, 2021, 09:50:12 AM »
The DCSearch_v1.8.2_SMF2.zip mod file seems to be missing? Does anybody still have it?

Offline TourFL

  • Semi-Newbie
  • *
  • Posts: 73
Re: Search Enhancement Mod
« Reply #435 on: January 18, 2021, 02:23:19 AM »
Here you go :)



(edit-- mod removed from attachment)
« Last Edit: January 18, 2021, 05:35:34 PM by Kindred »
If you like Fiat 500 and derived models, the SMF forum I'm helping with: www.500-126.com

Offline GL700Wing

  • Sr. Member
  • ****
  • Posts: 701
  • Gender: Female
Re: Search Enhancement Mod
« Reply #436 on: January 18, 2021, 05:10:49 PM »
The DCSearch_v1.8.2_SMF2.zip mod file seems to be missing? Does anybody still have it?
1.1Nerd - Please do not PM me to request support or to ask me to send you copies of mods that are no longer available to download (if a mod author has removed a mod they have done so for good reason).

Here you go :)
Thanks - 1.1Nerd asked me for a copy via PM but, given it was no longer available for download within this topic, I didn't know if anyone was allowed to share it again.
Life doesn't have to be perfect to be wonderful ...

Offline shadav

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 1,445
  • Gender: Female
    • shadav on Facebook
    • leashadav on GitHub
    • Foamy Fanatics :: For All Your Foamy The Squirrel Needs
Re: Search Enhancement Mod
« Reply #437 on: January 18, 2021, 05:16:20 PM »
I'm confused, because it's still showing on the mod page....I just downloaded it to test and downloaded without a problem....so what is missing?

Offline GL700Wing

  • Sr. Member
  • ****
  • Posts: 701
  • Gender: Female
Re: Search Enhancement Mod
« Reply #438 on: January 18, 2021, 06:29:38 PM »
I'm confused, because it's still showing on the mod page....I just downloaded it to test and downloaded without a problem....so what is missing?

The SMF2 version (ie, DCSearch_v1.8.2_SMF2.zip) ...
Life doesn't have to be perfect to be wonderful ...

Offline shadav

  • Support Specialist
  • SMF Hero
  • *
  • Posts: 1,445
  • Gender: Female
    • shadav on Facebook
    • leashadav on GitHub
    • Foamy Fanatics :: For All Your Foamy The Squirrel Needs
Re: Search Enhancement Mod
« Reply #439 on: January 18, 2021, 07:54:38 PM »
ah, well unfortunately the mod author removed it, nothing anyone else can really do unless they decide to reupload it

someone could maybe post instructions on how to make it work on 2.x but can't upload the zip per license.