similar topics mod - Stopwörter ?
Forumsregeln
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
phpBB 2.0 hat das Ende seiner Lebenszeit überschritten
phpBB 2.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 2.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf phpBB 3.0, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
similar topics mod - Stopwörter ?
Larsneo empfahl das unten (er nannte es allerdings noch quick and dirty)
für die viewtopic.php.
Funktioniert ohne Fehlermeldung. Nun habe ich noch search_stopwords.txt auf /language/lang_german/ gelegt, aber mir scheint diese Textdatei der nicht zu wertenden Topic-Wörter wird ignoriert ?
Ich bekomme trotzdem x Themen mit Wörtern, die in meinem Forum häufig vorkommen. Funktioniert es bei jemand, ich weiß nur, daß Lars Neo es hinbekommen hat.
// Similar Topics
// check against stopwords and synonyms start
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
$stopword_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_stopwords.txt');
$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt');
$title_search = "";
$title_search_array = array();
$title_search_array = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ? split_words(clean_words('similar', stripslashes($topic_title), $stopword_array, $synonym_array), 'search') : split(' ', $topic_title);
for($i = 0; $i < count($title_search_array); $i++)
{
$title_search .= $title_search_array[$i]. ' ';
}
// check against stopwords and synonyms end
$sql = "SELECT topic_id
FROM ". TOPICS_TABLE ."
WHERE topic_id != $topic_id
AND forum_id NOT IN (4,9,16)
AND MATCH (topic_title) AGAINST ('". addslashes($title_search) ."')
ORDER BY topic_time DESC LIMIT 0,10";[/b]
für die viewtopic.php.
Funktioniert ohne Fehlermeldung. Nun habe ich noch search_stopwords.txt auf /language/lang_german/ gelegt, aber mir scheint diese Textdatei der nicht zu wertenden Topic-Wörter wird ignoriert ?
Ich bekomme trotzdem x Themen mit Wörtern, die in meinem Forum häufig vorkommen. Funktioniert es bei jemand, ich weiß nur, daß Lars Neo es hinbekommen hat.
// Similar Topics
// check against stopwords and synonyms start
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
$stopword_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_stopwords.txt');
$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt');
$title_search = "";
$title_search_array = array();
$title_search_array = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ? split_words(clean_words('similar', stripslashes($topic_title), $stopword_array, $synonym_array), 'search') : split(' ', $topic_title);
for($i = 0; $i < count($title_search_array); $i++)
{
$title_search .= $title_search_array[$i]. ' ';
}
// check against stopwords and synonyms end
$sql = "SELECT topic_id
FROM ". TOPICS_TABLE ."
WHERE topic_id != $topic_id
AND forum_id NOT IN (4,9,16)
AND MATCH (topic_title) AGAINST ('". addslashes($title_search) ."')
ORDER BY topic_time DESC LIMIT 0,10";[/b]
Ich muß vielleicht dazu sagen, daß das für mich alles ziemlich "arabisch" aussieht, da sich meine Programmierkenntnisse darauf beschränken, daß ich vor über 10 Jahren mal bißchen Pascal und Basic, heute noch wenig HTML, gemacht habe, also nur grob ahnen kann, was dort überhaupt steht.
Trotzdem glaube ich zu ahnen, es müßte schon FAST richtig sein und es wird früher oder später einen Mod Update oder sowas geben.
Trotzdem glaube ich zu ahnen, es müßte schon FAST richtig sein und es wird früher oder später einen Mod Update oder sowas geben.

Zuletzt geändert von Dresden am 06.06.2005 15:44, insgesamt 1-mal geändert.
Hello, i have a problem with Larsneo mod : when you use it, the first word of each topic title is not use anymore as a keyword for similar topics.
E.g.1
Title : "Italians like Schumacher"
Similar titles : "Super Schumacher", "New win for Schumacher"
not similar : "Schumacher wins" (because Schumacher is the first word).
E.g.2
Title : "Schumacher wins"
Similar titles : none (Does not see the word Schumacher).
This only happens when using the Larsneo mode which is very useful otherwise.
Do you have the same problem ?
Any help would be greatly appreciated.
Danke
My code in viewtopic.php
E.g.1
Title : "Italians like Schumacher"
Similar titles : "Super Schumacher", "New win for Schumacher"
not similar : "Schumacher wins" (because Schumacher is the first word).
E.g.2
Title : "Schumacher wins"
Similar titles : none (Does not see the word Schumacher).
This only happens when using the Larsneo mode which is very useful otherwise.
Do you have the same problem ?
Any help would be greatly appreciated.
Danke

My code in viewtopic.php
// Similar Topics
// check against stopwords and synonyms start
include($phpbb_root_path . 'includes/functions_search.'.$phpEx);
$stopword_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_stopwords.txt');
$synonym_array = @file($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/search_synonyms.txt');
$title_search = "";
$title_search_array = array();
$title_search_array = ( !strstr($multibyte_charset, $lang['ENCODING']) ) ? split_words(clean_words('similar', stripslashes($topic_title), $stopword_array, $synonym_array), 'search') : split(' ', $topic_title);
for($i = 0; $i < count($title_search_array); $i++)
{
$title_search .= $title_search_array[$i]. ' ';
}
// check against stopwords and synonyms end
$sql = "SELECT topic_id
FROM ". TOPICS_TABLE ."
WHERE topic_id != $topic_id
AND forum_id IN ($forum_id)
AND MATCH (topic_title) AGAINST ('". addslashes($title_search) ."')
ORDER BY topic_time DESC LIMIT 0,10";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not get main information for similar topics", '', __LINE__, __FILE__, $sql);
}
$topics = array();
while ( $row = $db->sql_fetchrow($result) )
{
$topics[] = $row;
}
$count_similar = count($topics);
if ( $count_similar > 0 )
{
$template->assign_block_vars('similar', array(
'L_SIMILAR' => $lang['Similar'],
'L_TOPIC' => $lang['Topic'])
);
for($i = 0; $i < $count_similar; $i++)
{
$sql = "SELECT t.topic_type, t.topic_status, t.topic_id, t.topic_title, t.topic_time, t.topic_replies, t.topic_last_post_id, u.user_id, u.username, f.forum_id, f.forum_name, p.post_time, p.post_username
FROM ". TOPICS_TABLE ." t, ". USERS_TABLE ." u, ". FORUMS_TABLE ." f, ". POSTS_TABLE ." p
WHERE t.topic_id = '". $topics[$i]['topic_id'] ."'
AND f.forum_id = t.forum_id
AND p.topic_id = t.topic_id
GROUP BY t.topic_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Could not get similar topics", '', __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$similar = $row;
$tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_t']) : array();
$tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] .'_f']) : array();
$title = (strlen($similar['topic_title']) > 40) ? (substr($similar['topic_title'], 0, 37) . '...') : $similar['topic_title'];
$topic_url = '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL .'='. $similar['topic_id']) .'">'. $title . '</a>';
$template->assign_block_vars('similar.topics', array(
'TOPICS' => $topic_url,
'POST_URL' => $post_url)
);
} // while
} // for $i
} // if ( $count_similar > 0 )
//
// End Similar. Go ahead and pull all data for this topic
//
Hello koalaii,
I think that this solution is descended from the search.php
but it seems to works for similar topics just as well.
No problems with the first word by now -->
http://www.net4seven.de/ftopic587.html
Similar keyword: neue
Same forum_id is required. True?
easy
I think that this solution is descended from the search.php
but it seems to works for similar topics just as well.
No problems with the first word by now -->
http://www.net4seven.de/ftopic587.html
Similar keyword: neue
koalaii hat geschrieben:AND forum_id IN ($forum_id)
Same forum_id is required. True?

Danke for your answer.
In fact there is a problem with the upper/lower case.
If i remove in function_search the line
then topics with same keywords in different upper/lower case won't match.
If i keep this line then it creates some other problems with other topics like this :
One example :
http://mta2002.free.fr/phpBB2/1102
keyword should be "BTCC" (works fine when the above code is removed)
Other "BTCC" topics in the same forum : http://mta2002.free.fr/phpBB2/842
and many others...
(The line in function search has not been removed)
Another example :
http://mta2002.free.fr/phpBB2/571
Keyword : courroie distribution
It wont look at a topic called COURROIE DE DISTRIBUTION because it is in upper case.
But if we open
http://mta2002.free.fr/phpBB2/1059
Keyword : COURROIE DE DISTRIBUTION
It will looks for its lower case and will find topics in lower case with the "courroie distribution" keyword...
To fix this issue, i have changed viewtopic.php with :
Still i'm not sure it works perfectly. One issue is the current topic is sometime in the list of similar topics...
i don't know how to avoid that.
Yes, i've changed the mod so the same forum is required for similar topics. You can also see i've changed the mod so it is lighter (i only have the 5 similar topics title under the topic title).
If someone knows what problem it could be. It's very strange and too bad because otherwise this mod is brilliant. It should be on the phpBB.com database.
Danke
koalaii
In fact there is a problem with the upper/lower case.
If i remove in function_search the line
Code: Alles auswählen
$entry = ' ' . strip_tags(strtolower($entry)) . ' ';
If i keep this line then it creates some other problems with other topics like this :
One example :
http://mta2002.free.fr/phpBB2/1102
keyword should be "BTCC" (works fine when the above code is removed)
Other "BTCC" topics in the same forum : http://mta2002.free.fr/phpBB2/842
and many others...
(The line in function search has not been removed)
Another example :
http://mta2002.free.fr/phpBB2/571
Keyword : courroie distribution
It wont look at a topic called COURROIE DE DISTRIBUTION because it is in upper case.
But if we open
http://mta2002.free.fr/phpBB2/1059
Keyword : COURROIE DE DISTRIBUTION
It will looks for its lower case and will find topics in lower case with the "courroie distribution" keyword...
To fix this issue, i have changed viewtopic.php with :
Code: Alles auswählen
AND MATCH (topic_title) AGAINST ('". addslashes(strtolower($title_search)) ."')
OR MATCH (topic_title) AGAINST ('". addslashes(strtoupper($title_search)) ."')

Yes, i've changed the mod so the same forum is required for similar topics. You can also see i've changed the mod so it is lighter (i only have the 5 similar topics title under the topic title).
If someone knows what problem it could be. It's very strange and too bad because otherwise this mod is brilliant. It should be on the phpBB.com database.
Danke
koalaii
Zuletzt geändert von koalaii am 07.08.2005 13:14, insgesamt 7-mal geändert.
Another thing (the last) :
That would be great if we can only look at topics posted before the current one. That way, each time we click on the similar topics link, we go further in the past (instead of having always the same 5 similar topics).
Also show to show the similar topics only on the first page of the current topic (if it has multi pages) ?
Danke
koalaii
Code: Alles auswählen
ORDER BY topic_time DESC LIMIT 0,5";
Also show to show the similar topics only on the first page of the current topic (if it has multi pages) ?
Danke
koalaii
-
- Mitglied
- Beiträge: 1862
- Registriert: 23.12.2004 22:46
Kleine Frage: Gibt es dieses Update schon (oder heuer noch)? Habe die Antwort nicht selbst gefunden. In der Mod-Datenbank steht ja noch 29.09.2004 als Datum des Mods: http://www.phpbb.de/moddb/mod.php?id=169Leuchte hat geschrieben:Aber wie ich schon in einem anderen Beitrag geschrieben habe, wird es in nächster Zeit ein Update mit enthaltenen Funktionen geben. Nur eine Frage der Zeit
LG, IPB_Flüchtling