首页 > 技术文章 > 对MariaDB10.0的Sphinx进行扩展

kgdxpr 2017-03-21 13:18 原文

已修改过的文件:http://pan.baidu.com/s/1o8DHvkA

将这两个文件放到MariaDB的解压目录后,再进行安装

/usr/local/mariadb-10.0.28/storage/sphinx/

如下是修改的代码

get_rec ( byte * buf, const byte * key, uint keylen,uint a,uint b,uint c );

index_next_same ( byte * buf, const byte * key, uint keylen,uint a,uint b,uint c );

SPHINXSE_SYSTEM_COLUMNS 6

SPH_RET ( get_rec ( buf, key, key_len ,pTable->m_tStats.m_iMatchesTotal,pTable->m_tStats.m_iMatchesFound,pTable->m_tStats.m_iQueryMsec ) );

field[3]->store ( a, 1 );
field[4]->store ( b, 1 );
field[5]->store ( b, 1 );

SPH_RET ( get_rec ( buf, m_pCurrentKey, m_iCurrentKeyLen,m_a,m_b,m_c ) );

int ha_sphinx::index_next_same ( byte * buf, const byte * key, uint keylen,uint a,uint b,uint c )
{
        SPH_ENTER_METHOD();
        SPH_RET ( get_rec ( buf, key, keylen,a,b,c ) );
}

int ha_sphinx::get_rec ( byte * buf, const byte *, uint ,uint a,uint b,uint c)

uint                    m_a;
uint                    m_b;
uint                    m_c;

, m_a ( 0 )
, m_b ( 0 )
, m_c ( 0 )

 

CREATE TABLE `table_sphinxse` (
  `id` bigint(20) unsigned NOT NULL,
  `weight` int(11) DEFAULT '1',
  `query` varchar(20480) NOT NULL,
  `Matchestotal` int(11) DEFAULT '0',
  `Matchesfound` int(11) DEFAULT '0',
  `Querymsec` int(11) DEFAULT '0',
  `Fadd_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
  KEY `query` (`query`(1024))
) ENGINE=SPHINX DEFAULT CHARSET=utf8 CONNECTION='sphinx://127.0.0.1:4312';
select sql_no_cache id,matchesfound from table_sphinxse where query='filter=res_type,1';

共多少条

 

推荐阅读