- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经开始使用Sphinx并尝试安装sphinx。一切正常,但我想搜索部分关键字。我想知道如何在网页中显示结果。
例如
我搜索“吃”
结果应该是:“ate”、“update”、“late”、“hate”等.
我的 sphinx.con :
source src1
{
type = mysql
sql_host = localhost
sql_user = username
sql_pass = *******
sql_db = db_name
sql_port = 3306 # optional, default is 3306
sql_query = \
SELECT id, msgtext, created \
FROM agi_sms
sql_attr_string = msgtext
sql_attr_timestamp = created
sql_query_info = SELECT * FROM agi_sms WHERE id=$id
}
index test1
{
source = src1
path = C:/Sphinx/data/test1
docinfo = extern
charset_type = sbcs
enable_star = 1
morphology = stem_en
min_infix_len = 2
infix_fields = msgtext
dict = keywords
}
indexer
{
mem_limit = 32M
}
searchd
{
listen = 9312
listen = 9306:mysql41
log = C:/Sphinx/log/searchd.log
query_log = C:/Sphinx/log/query.log
read_timeout = 5
max_children = 30
pid_file = C:/Sphinx/log/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
workers = threads # for RT to work
binlog_path = C:/Sphinx/data
}
这是我的 php 文件:
$cl = new SphinxClient ();
$q = $_POST['search'];
$sql = "";
$mode = SPH_MATCH_EXTENDED2;
$host = "localhost";
$port = 9312;
$index = "*";
$groupby = "";
$filter = "created";
$filtervals = array();
$distinct = "";
$sortby = "";
$sortexpr = "";
$limit = 20;
$ranker = SPH_RANK_PROXIMITY_BM25;
$select = "";
////////////
// do query
////////////
$cl = new SphinxClient();
$cl->SetServer( "localhost", 9312 );
$cl->SetMatchMode( SPH_MATCH_ANY );
$cl->SetFilter( 'created', array( 3 ) );
$res = $cl->Query ( $q, $index );
////////////////
// print me out
////////////////
if ( $res===false )
{
print "Query failed: " . $cl->GetLastError() . ".\n";
} else
{
if ( $cl->GetLastWarning() )
print "WARNING: " . $cl->GetLastWarning() . "\n\n";
print "<li>Query '$q' retrieved $res[total] of $res[total_found] matches in $res[time] sec.\n</li>";
print "<li>Query stats:\n";
if ( is_array($res["words"]) )
foreach ( $res["words"] as $word => $info )
print " '$word' found $info[hits] times in $info[docs] documents\n</li>";
print "\n";
}
结果:
Query 'good' retrieved 0 of 0 matches in 0.007 sec.
Query stats: 'good' found 7534 times in 7534 documents
但是如果我尝试搜索“goo”,它什么也没搜索到。
Query 'goo' retrieved 0 of 0 matches in 0.000 sec.
Query stats: 'goo' found 0 times in 0 documents
我想得到所有包含单词/字母“goo”的结果。
像这样:
Array(1 element) {
0 Object {
id = 1,
message = Good Morning
}
2 Object {
id = 2,
message = Good Day!
}
}
最佳答案
$cl->SetFilter( 'created', array( 3 ) ); are you sure you have records with created=3? Also for wildcard searching you should do 'goo*' ( mark the * ) or set expand_keywords = 1.
关于php - sphinx 搜索 : Partial keyword,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20966281/
import csv import numpy as np from sklearn.svm import SVR import matplotlib.pyplot as plt dates = []
我在 ANTLRWorks 1.4 中有以下语法。我正在考虑在文本冒险游戏创建器中实现解析器的想法,其中用户将为他的游戏指定各种允许的命令。 grammar test; parse :
我有一个 .dat 文件,我首先想将其转换为 .csv 文件,然后根据时间绘制一些行,我的脚本如下: import pandas as pd import numpy as np from sys i
python 出现SyntaxError: non-keyword arg after keyword arg错误解决办法 前言:
我有一个我无法理解的问题,因此在删除按钮中,尝试在创建按钮后将其删除的地方,出现以下错误: Delete=Button(root,text='Delete',command=lambda : S.pa
我想将某个函数作为线程运行,但我得到了 SyntaxError: non-keyword arg after keyword arg 我不明白为什么: #!/usr/bin/env python im
我试图在 scrappy 中抓取多个页面,我的函数确实返回第一个起始网址,但我无法设法使蜘蛛的规则生效。 这是我到目前为止所拥有的: import scrapy from scrapy.contrib
我正在使用 emeditor,我试图从法语维基百科转储 .xml 文件(20GB,3.38 亿行,总共 480 万篇文章)中分离出大约 200 万篇包含 keyword3 的文章。我想将文本包含在 2
发布表如下所示: publications ============ id title etc ... 关键字表如下所示: keywords ======== id name etc ... keyw
我有这个功能: def crypting(self, client, access_token, client_id, client_secret, oauth_scope, redirect_uri
我正在学习 Rails,但在以下代码中出现语法错误 unexpected keyword else, expected keyword end,我不知道为什么。
我正在一个网站上工作,我必须在数据库中搜索根域上/之后的字符串。我在文档中找不到任何有关它的信息。我正在尝试使其与 Iron Router 一起使用,但任何其他建议都会起作用。 感谢您的帮助! 编辑:
我刚刚找到有关 apache solr 的信息,并且在我成功安装了带有 Tomcat 的 apache Solr 之后。然后我开始使用 Apache Solr 进行搜索。 但我对 Apache Sol
我是 Angular JS 新手。我无法弄清楚过滤器如何仅对对象中的名称起作用,而不是对对象中的电话键起作用。就好像我们在 ng-model 中仅使用关键字一样,它将过滤范围中定义的对象中的名称和电话
当我运行以下代码行时,我试图将按钮按下绑定(bind)到 Tkinter 中的函数 get = Button(root, lambda: ChangeColour(boxes[1][2], boxes
response = requests.post("http://api.bf3stats.com/pc/player/", data = player, opt) 在 python IDLE 中运行
这是我正在操作的更新查询。此处错误“set data = :updateValue”,数据是 Dynamo DB 的保留关键字。我想我应该在这里使用 update ExpressionAttribut
根据维基百科,二元运算符 ?:是 colloquially referred to as the Elvis operator due to its resemblance to an emotico
我知道 AND 词定义了二进制 and ...但什么定义了逻辑and ? 最佳答案 同一个字,AND , 也用于逻辑与。但是这两个输入值要AND推荐为格式良好的标志 ; 真和 假 由两个值表示,位全部
反引号运算符的固定性是什么? 例如在 Real World Haskell 的这段代码中: ghci> (1+) `fmap` [1,2,3] ++ [4,5,6] [2,3,4,4,5,6] 很明显
我是一名优秀的程序员,十分优秀!