News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Search Enhancement Mod

Started by ioszilla, August 12, 2007, 05:53:15 PM

Previous topic - Next topic

sangham.net

#420
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!


NekoJonez

This mod doesn't work on my other themes.
Retro video game blogger, writer, actor, podcaster and general amazing dude.

Twitter
My Blog

FragaCampos

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)

Quote from: Johann B 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!



sangham.net

Thanks for your care and answers, FragaCampos.


GL700Wing

Quote from: knarf32222 on August 19, 2008, 09:44:01 PM
Quote from: knarf32222 on August 19, 2008, 05:22:27 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

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

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

Replace with
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 ...

Hristo

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:

$default = 'entireforum';

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

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


Replace with:

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';}



FragaCampos

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.  :-\

TourFL

Quote from: TourFL on February 12, 2013, 10:45:44 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:


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

TourFL

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:
$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:
[...] CASE WHEN lst.id_topic IS NULL THEN {float:non_subject_plus_body_double_matching_multiplier} ELSE 1 END [...]


New code
[...]  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

mountain90


crazyASD

Some stupid question. Where is  DCSearch_v1.8.2_SMF2.zip for SMF 2.x?

TourFL

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

FragaCampos

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:
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?


1.1Nerd

Does anybody know if this mods works with SMF 2.0.17?

1.1Nerd

The DCSearch_v1.8.2_SMF2.zip mod file seems to be missing? Does anybody still have it?

TourFL

#435
Here you go :)



(edit-- mod removed from attachment)
If you like Fiat 500 and derived models, the SMF forum I'm helping with: www.500-126.com

GL700Wing

Quote from: 1.1Nerd 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?
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).

Quote from: TourFL on January 18, 2021, 02:23:19 AM
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 ...

shadav

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?

GL700Wing

Quote from: shadav 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?

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

shadav

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.

Advertisement: