Intermediary transaction http://www.aliyun.com/zixun/aggregation/6858.html ">seo diagnose Taobao guest cloud host technology Hall
The importance of the inner chain I don't need to tell you all about it. The correlation of inner chain (same as outside chain) is an important index. Taking the Discuz program as an example, this paper discusses how to use Coreseek Full-text search system to construct high correlation inner chain.
I. Status QUO
Now the automatic production chain generally has two methods: one is by inserting the same tag in the chain, the second is to specify the keyword, in the article encountered the corresponding key words are automatically inserted inside the chain of methods to do the chain.
However, the two methods have shortcomings, the former method if the automatic generation of tag, often with a large number of the generation of tag, correlation can not be guaranteed, if the manual set tag is a long-term very cumbersome work; the latter method to manually preset keywords, one tedious, Secondly, the key without a preset will not automatically generate the inner chain, typos this method
In general, it is necessary to encounter the corresponding keywords to generate the same internal chain correlation is not necessarily high.
Disuz's own related post functions are also divided into two kinds. One is the implementation of the tag, there are the shortcomings mentioned above; another for the vertical and horizontal search belt, but pit dad is this related posts are implemented with JavaScript, for SEO basic useless.
Second, how to automatically generate a high degree of correlation within the chain?
First of all to solve the problem of how to determine the degree of correlation. We can use the title of the target article to the database with the existence of the article title or the full text of similar levenshtein algorithms to compare, find the correlation of the first or several to do the chain, rather than simply capture a specific keyword or tag.
As far as I know Coreseek Full-text search system based on phrase similarity and statistics (BM25) Composite ranking method, can easily and efficiently realize such a function, we can easily use, have the ability to write their own program to achieve.
Three, the following take Discuz as an example to illustrate how to achieve.
Ideas are as follows: Whenever the post is accessed automatically take the title of the posts to Coreseek search, to find a high degree of matching articles. Then add the link to the post that you found.
1, first of all, the correct installation of Coreseek, installation methods can refer to the official website or my web site Four Seasons Clothing network WWW#4JI#CN find << set up discuz under the Coreseek full-text Search server and the construction of personalized word library >> this person post. Installation looks very complicated, in fact, installation is not difficult, follow the tutorial step by step.
2, write a discuz plug-in to achieve the above mentioned functions:
Do not know how to program the first sweat, Plug-ins have been written, the following will give a download link.
Here only about the working principle of plug-ins is: discuz template inside put a lot of hook hooks, here we use Viewthread_postbottom, open the post, Viewthread_postbottom trigger the corresponding method in the plug-in, This method takes the title of the post to Coreseek search, to find the article with high matching degree.
Then add the link to the post that you found.
Iv. Main Source code
Due to limited capacity, procedures may not be perfect, please correct me.
<?php
/**
* A class of related aspires for discuz! X2 & X2.5
* @author D2002
* Copyright @ http://www.4ji.cn
*/
class Plugin_dean_related_article {
function Plugin_dean_related_article () {
Global $_g;
$this->display_qty = $_g[' cache ' [' plugin '] [' dean_related_article '] [' display_qty '];
$this->weight = $_g[' cache '] [' plugin '] [' dean_related_article '] [' weight '];
$this->index = $_g[' cache ' [' plugin '] [' dean_related_article '] [' index '];
}
}
class Plugin_dean_related_article_forum extends Plugin_dean_related_article {
Public Function Viewthread_postbottom_output () {
Global $_g;
require_once libfile (' Class/sphinx ');
$s = new sphinxclient ();
$s->setserver ($_g[' setting '] [' sphinxhost '], intval ($_g[' setting '] [' sphinxport ']);
$s->setmaxquerytime (intval ($_g[' setting '] [' sphinxmaxquerytime ']);
$s->setrankingmode ($_g[' setting '] [' Sphinxrank ']);
$s->setlimits (0, $this->display_qty, $this->display_qty);
$s->setmatchmode (sph_match_any);
$subject = mb_convert_encoding ($_g[' forum_thread '] [' subject '], ' UTF-8 ', ' GBK ');
$ori _tid = $_g[' forum_thread ' [' tid '];
if ($this->index==1) $result = $s->query ($subject, $_g[' setting '] [' sphinxsubindex ']);
else $result = $s->query ($subject, "*");
$tids = Array ();
if ($result) {
if (Is_array ($result [' matches ']) {
foreach ($result [' matches '] as $value) {
if ($value [' attrs '] [' tid ']&& $value [' attrs '] [' tid ']!= $ori _tid&& $value [' Weight ']>= $this- >weight) {
$tids [$value [' attrs '] [' tid ']] = $value [' attrs '] [' tid '];
}
}
}
}
//return $tids;
$out = "<div id= ' relate_subject ' ><div class= ' rs_main ' ><div class= ' rs_head ' ><h3 class=" Has_ Adv ' > Related posts </h3></div>;
$out. = "<ul id= ' rel_list ' >";
if (!empty ($tids)) {
$ids = Implode (",", $tids);
$query = db::query (select Tid,subject from). Db::table (' Forum_thread '). " WHERE tid in ($ids) and displayorder>= ' 0 ' ORDER by tid DESC ");
while ($thread = Db::fetch ($query)) {
$threadlist [$thread [' Tid ']]= $thread;
}
$flag = 1;
foreach ($threadlist as $th) {
if ($flag ==1) {
$out. = "<li class= ' Right_item ' >";
$flag = 0;
}else{
$out. = "<li class= ' Left_item ' >";
$flag = 1;
}
$out. = "<a href= ' thread-$th [tid]-1.html ' > $th [subject]</a></li>";
}
}else{
return Array ();
}
$out. = "</ul></div></div>";
Return Array ($out);
}
}
?>
Five
This article is just a construction of the idea of the chain, spread out, this method can easily be used in a variety of programs, and even can be used across stations. I hope I can help you.
Six
Because the plug-in without rigorous testing, and need to install Coreseek as a prerequisite, so not in the Discuz application website. If you need to be available to my website Four Seasons clothing network http://www#4ji#cn/thread-9326-1.html free download Full installation package
This article by the Four Seasons clothing net original, reprint please retain the copyright