请教一个Coreseek的问题

没有昵称 2016-04-06 02:41:10
问题大概是这样的
我已经做好了一个mysql的全文检索 配置文件如下 其中news是可以正常检索的
现在有个新需求就是新添加一个检索表 book
找了一些资料写了book的index继承了news
但是在程序里调用的时候发现没有查询到book的信息
我用的是SphinxConnector的dll进行检索

程序调用的代码如下
 using (TcpConnection connection = new PersistentTcpConnection("127.0.0.1", 9312))
{

SearchCommand search = new SearchCommand(connection);

SearchQuery query = new SearchQuery(key);
// Sphinx indexes
//query.Indexes.UnionWith();
// select fields clause
query.Select = "1";
// match type
query.MatchMode = 0;
// ranking
query.RankingMode = 0;
// comment
query.Comment = "";
// sorting
query.SortMode = 0;
query.SortBy = "";
// limits
query.Limit = query.MaxMatches = 3;
// document id filtering
query.MinDocumentId = 0;
query.MaxDocumentId = 0;
// grouping
query.GroupFunc = 0;
query.GroupBy = "";
query.GroupSort = "";
query.GroupDistinct = "";

//query.AttributeFilters.Add(new AttributeFilterRangeDateTime("PublishDate", PublicationStartDate.Value, PublicationEndDate.Value, false));

// index weights
search.QueryList.Add(query);

// run the query and get the results
string output = "";
try
{
search.Execute();
}
catch (SphinxException ex)
{
output = "<h2 style='color: red;'>Error is occured:<h2>" + ex.Message;
return output;
}


foreach (SearchQueryResult res in search.Result.QueryResults)
{
foreach (Sphinx.Client.Commands.Search.Match mt in res.Matches)
{
output += mt.DocumentId + ",";
}
}
if (output.Length > 0)
{
output = output.Substring(0, output.Length - 1);
}
return output;
}


#MySQL数据源配置,详情请查看:http://www.coreseek.cn/products-install/mysql/
#请先将var/test/documents.sql导入数据库,并配置好以下的MySQL用户密码数据库

#源定义
source news
{
type = mysql

sql_host = 192.168.1.8
sql_user = news
sql_pass = news
sql_db = news_test
sql_port = 3306
sql_query_pre = SET NAMES utf8


sql_query = SELECT NewsId as id,DataDate as datadate,NewsTitle as title, NewsTitleText,NewsContentText from table_news
#sql_query第一列id需为整数
#title、content作为字符串/文本字段,被全文索引

sql_attr_string = NewsTitleText
sql_attr_string = NewsContent
sql_attr_timestamp = datadate

sql_query_info_pre = SET NAMES utf8 #命令行查询时,设置正确的字符集
#sql_query_info = SELECT * FROM table_news WHERE NewsId=$id #命令行查询时,从数据库读取原始数据信息
sql_query_info = SELECT * WHERE ID=$id
}

source book : news
{
sql_query = SELECT ID as id, Title as title,Author as author,Publisher as publisher,ISBN13 as isbn13 FROM book
}

#index定义
index news
{
source = news #对应的source名称
path = C:\Coreseek\coreseek-4.1-win32\var\data\mysql #请修改为实际使用的绝对路径,例如:/usr/local/coreseek/var/...
docinfo = extern
mlock = 0
morphology = none
min_word_len = 1
html_strip = 0

#中文分词配置,详情请查看:http://www.coreseek.cn/products-install/coreseek_mmseg/
#charset_dictpath = /usr/local/mmseg3/etc/ #BSD、Linux环境下设置,/符号结尾
charset_dictpath = C:\Coreseek\coreseek-4.1-win32\etc #Windows环境下设置,/符号结尾,最好给出绝对路径,例如:C:/usr/local/coreseek/etc/...
charset_type = zh_cn.utf-8
}


index book : news
{
source = book
path = C:\Coreseek\coreseek-4.1-win32\var\data\mysql
}

#全局index定义
indexer
{
mem_limit = 256M
}

#searchd服务定义
searchd
{
listen = 9312
read_timeout = 5
max_children = 30
max_matches = 1000
seamless_rotate = 0
preopen_indexes = 0
unlink_old = 1
pid_file = C:\Coreseek\coreseek-4.1-win32\var\log\searchd_mysql.pid

log = C:\Coreseek\coreseek-4.1-win32\var\log\searchd_mysql.log
query_log = C:\Coreseek\coreseek-4.1-win32\var\log\query_mysql.log
compat_sphinxql_magics = 0

}


拜托各位了
...全文
76 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
没有昵称 2016-04-06
  • 打赏
  • 举报
回复
石沉大海了啊

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧