许多技术级高的网站中,特别是文章类型的网站有全文检索和“相关类型文章”的功能,我想设计一种“相关文章”功能可以按照相关程度和时间的顺序进行排序,数据库应该可以实现,我想请教现有的成熟的技术   也就是许多网站是怎么实现的,另外还有没有更好的方法对之完善? 谢谢您的回答

解决方案 »

  1.   

    设置关键字,分词
    http://topic.csdn.net/u/20110124/17/ffe58612-1173-4886-a63d-7e61f3da17ae.html
      

  2.   

    public static string get_semblance_By_2words(string word1, string word2)
      {
      int re = 0;
      int maxLength;
      int i, l;
      List<string> tb1 = new List<string>();
      List<string> tb2 = new List<string>();
      i = 0;
      l = 1;
      maxLength = word1.Length;
      if (word1.Length < word2.Length)
      maxLength = word2.Length;
      while (l <= word1.Length)
      {
      while (i < word1.Length - 1)
      {
      if (i + l > word1.Length)
      break;
      tb1.Add(word1.Substring(i, l));
      i++;
      }
      i = 0;
      l++;
      }
      i = 0;
      l = 1;
      while (l <= word2.Length)
      {
      while (i < word2.Length - 1)
      {
      if (i + l > word2.Length)
      break;
      tb2.Add(word2.Substring(i, l));
      i++;
      }
      i = 0;
      l++;
      }
      foreach (string subStr in tb1)
      {
      int tempRe = 0;
      if (tb2.Contains(subStr))
      {
      tempRe = subStr.Length * 100 / maxLength;
      if (tempRe > re)
      re = tempRe;
      if (tempRe == 100)
      break;
      }
      }
      return re.ToString() + "%";
      }
      

  3.   

    简单点的功能就是LIKE查询了。