开拓族能解决哪些问题?

平凉SEO——将为您带来什么?

平凉SEO方案

平凉SEO案例

平凉SEO就选开拓族

开拓族 其他
服务

微信.旺旺.QQ全天在线,3小时内必回应

保证网站排名稳步提升.客户源源不断

价格

排名优化一条龙全包价

费用清晰透明,无隐形消费

专业

专注网站建设12年

专注排名优化10年

便捷

仅需选择套餐

开拓族为您完成所有繁杂SEO优化工作

安全

淘宝担保交易,安全放心

网站实名认证,安全省心

放心

排名提升再付款

服务

沟通形式单一,流程复杂,服务跟进缓慢

处理问题缓慢,排名迟迟没动静

价格

别看报价低

费用模糊,隐形消费多,排名不稳定

专业

只会做SEO外链优化

无法完成客户指定需求

便捷

需客户自己修改网站TDK

需客户自己定时更新文章

安全

微信.支付宝转账,资金有风险

网站未实名认证,不安全

放心

还未开始排名,就收费用

平凉SEO服务

免费赠送 888元 大礼包

西部数码空间1G

免费

¥188

国际域名.com

免费

¥55

数据库100M

免费

¥100

网站程序源代码

免费

¥145

网站LOGO设计

免费

¥200

网站架构SEO优化

免费

¥200

更多增值服务

平凉SEO建议

摘要:【企业】☑网站优化 ☑网络推广 ☑刷关键词 ☑网络营销 ☑平凉SEO【公司】☑快速排名 ☑百度排名 ☑排名工具 ☑搜索引擎 ☑SEO外包QQ:48844189 平凉SEO优化顾问服务公司哪家好?有哪些?选哪个

discuz全文检索文章的实现方法

首先说明:这个检索是直接用like来实现的,所以,如果你的站数据量大,这样很吃系统,自己掂量着办。搜索门户中的文章,并不是按这个走的,要么只能分中文要么只能分英文(学艺不精没细了解啊,个人测试是这样的)。而我目前碰到的要求是需要对文章也执行like。所以,经过研究,类比了下搜索文章标题的功能,成功实现了discuzX3对门户中的文章进行全文检索的功能,以下操作方法discuz版本为20140101的X3.1。具体方法如下:

1)用notepad++或其他文本编辑器打开下述文件

网站目录sourceclasstabletable_portal_article_content.php

在下面的

  1. class table_portal_article_content extends discuz_table
  2. {

后添加

  1. public function fetch_all_by_sql($where, $order = '', $start = 0, $limit = 0, $count = 0, $alias = '') {
  2. $where = $where && !is_array($where) ? " WHERE $where" : '';
  3. if(is_array($order)) {
  4. $order = '';
  5. }
  6. if($count) {
  7. return DB::result_first('SELECT count(*) FROM '.DB::table($this->_table).' %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order));
  8. }
  9. return DB::fetch_all('SELECT * FROM '.DB::table($this->_table).' %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order));
  10. }

变为:

  1. class table_portal_article_content extends discuz_table
  2. {
  3. public function fetch_all_by_sql($where, $order = '', $start = 0, $limit = 0, $count = 0, $alias = '') {
  4. $where = $where && !is_array($where) ? " WHERE $where" : '';
  5. if(is_array($order)) {
  6. $order = '';
  7. }
  8. if($count) {
  9. return DB::result_first('SELECT count(*) FROM '.DB::table($this->_table).' %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order));
  10. }
  11. return DB::fetch_all('SELECT * FROM '.DB::table($this->_table).' %i %i %i '.DB::limit($start, $limit), array($alias, $where, $order));
  12. }

上面添加那个方法才能用$query = C::t(‘portal_article_content’)->fetch_all_by_sql。

2)打开

网站目录sourcemodulesearchsearch_portal.php

搜索

  1. </p> <p> foreach($query as $article) {
  2. $ids .= ','.$article['aid'];
  3. $num++;
  4. }

在其后添加如下代码:

  1. if($num==0){
  2. list($srchtxt, $srchtxtsql) = searchkey($keyword, "content LIKE '%{text}%'", true);
  3. $query = C::t('portal_article_content')->fetch_all_by_sql(' 1 '.$srchtxtsql, 'ORDER BY aid DESC ', 0, $_G['setting']['search']['portal']['maxsearchresults']);
  4. foreach($query as $article) {
  5. $ids .= ','.$article['aid'];
  6. $num++;
  7. }
  8. }

代码的意思是:如果搜标题没搜到,那就用like来搜文章的内容。

保存后,更新下discuz的缓存,搜文章里的内容试试,如果能搜到,OK,大功告成~