sphinx

How to write sphinx queries with OR condition

耗尽温柔 提交于 2019-12-24 03:42:10
问题 I need to create a sphinx query in my project with OR condition. But giving an OR condition like select cost FROM transactionsChart WHERE cost=25 OR cost=5; is not working. It returns an error like ERROR 1064 (42000): sphinxql: syntax error, unexpected OR, expecting $end near 'OR cost=5' Can anybody help me.... Thanks in advance 回答1: Sphinx doesnt support OR in the WHERE clause, only AND . For your specific example, could use IN syntax, sphinxql> SELECT cost FROM transactionsChart WHERE cost

搜索引擎框架介绍

一曲冷凌霜 提交于 2019-12-24 01:26:38
原文: 搜索引擎框架介绍 一、搜索引擎基础介绍 二、常见搜索引擎框架介绍与比较 三、参考文章 一、搜索引擎基础介绍 1. 什么是搜索引擎   搜索引擎,通常指的是收集了万维网上几千万到几十亿个 网页 并对网页中的每一个词(即关键词)进行索引,建立 索引数据库 的 全文搜索引擎 。当用户查找某个关键词的时候,所有在页面内容中包含了该关键词的网页都将作为搜索结果被搜出来。再经过复杂的算法进行排序(或者包含商业化的竞价排名、商业推广或者广告)后,这些结果将按照与搜索关键词的相关度高低(或与相关度毫无关系),依次排列。 2. 传统的搜索与搜索引擎对比 2.1 传统做法 (1)文档中使用系统的Find查找 (2)mysql中使用like模糊查询 存在问题: (1)海量数据中不能及时响应,少量数据可以通过传统的MySql建立索引解决 (2)一些无用词不能进行过滤,没法分词 (3)数据量大的话难以拓展 (4)相同的数据难以进行相似度最高的进行排序 2.2 搜索引擎做法 (1)存储非结构化的数据 (2)快速检索和响应我们需要的信息,快-准 (3)进行相关性的排序,过滤等 (4)可以去掉停用词(没有特殊含义的词,比如英文的a,is等,中文: 这,的,是等),框架一般支持可以自定义停用词 二、常见搜索引擎框架介绍与比较 1. Java 全文搜索引擎框架 Lucene 1.1 简介  

Sphinx Search how to use an empty before_match and after_match

喜夏-厌秋 提交于 2019-12-23 22:59:54
问题 Using Sphinx's SNIPPET() function, how can I remove any before_match and after_match from my query? I don't want anything wrapped around the matching text. SNIPPET(field, 'word', 'after_match=""', 'before_match=""') I've tried after_match="" but this adds literal quotes to the match. I've tried after_match=''" but this fails I've tried after_match= and this fails too Any suggestions? 回答1: My only suggestion is just to set it to some innocuous string, and then remove in post. 'after_match=*'

Django-sphinx result filtering using attributes?

淺唱寂寞╮ 提交于 2019-12-23 17:12:10
问题 I was going through the django-sphinx documentation, and it looks like it allows you to filter search results using attributes , queryset = MyModel.search.query('query') results1 = queryset.order_by('@weight', '@id', 'my_attribute') results2 = queryset.filter(my_attribute=5) results3 = queryset.filter(my_other_attribute=[5, 3,4]) results4 = queryset.exclude(my_attribute=5)[0:10] From some examples, these attributes seem to be something you specify in the sphinx configuration file, rather than

Thinking Sphinx Rake aborted, searchd is running while rebuilding or start/stop ts. Index works fine

牧云@^-^@ 提交于 2019-12-23 09:29:42
问题 When I invoke rake ts:rebuild RAILS_ENV=production , I get the following: (in /var/www/abc.com/public/abc/releases/20101008073517) ** Erubis 2.6.6 Stopped search daemon (pid 22531). Generating Configuration to /var/www/abc.com/public/abc/releases/20101008073517/config/production.sphinx.conf Sphinx 1.10-beta (r2420) Copyright (c) 2001-2010, Andrew Aksyonoff Copyright (c) 2008-2010, Sphinx Technologies Inc (http://sphinxsearch.com) using config file '/var/www/abc.com/public/abc/releases

AND multiple values of a filter in sphinx

拈花ヽ惹草 提交于 2019-12-23 04:33:18
问题 I have an attribute in my sphinx index tag_id and now I want to fetch all record that have tag_id 10 and 11 When I do $sphinxClient->setFilter('tag_id', array(10,11)) it fetches all have tag_id 10 or 11 Is it possible to AND both values rather than OR? 回答1: $sphinxClient->setFilter('tag_id', array(10)); $sphinxClient->setFilter('tag_id', array(11)); Multiple calls to setFilter are ANDed :) 回答2: Why would two different values return result with AND?? It's like WHERE id = 1 AND id = 2 WHICH

thinking sphinx error when rake thinking_sphinx:start

筅森魡賤 提交于 2019-12-23 04:17:15
问题 I am using gem 'thinking-sphinx', '2.0.10' for search functionality.I am following http://railscasts.com/episodes/120-thinking-sphinx tutorial for this. script/plugin install git://github.com/freelancing-god/thinking-sphinx.git rake thinking_sphinx:index These 2 steps executed without any problem,but when i did rake thinking_sphinx:start it was giving following error : Failed to start searchd daemon. Check /home/user/newsvn/alumnicell/log/searchd.log. Failed to start searchd daemon. Check

Does Sphinx (or other third party) search engine work in my case or should I create my own?

南笙酒味 提交于 2019-12-23 03:34:06
问题 I am creating a search function of my classifieds on my website. Here is some of the criteria I need to meet: When searching for 'bmw 520' only matches where these two words come in exactly this order is returned. not matches for only 'bmw' or only '520'. When searching for 'bmw 330ci' results as the above will be returned, but, WITH AND WITHOUT the ci extension. There are a nr of extensions in cars as you all know (i, ci, si, fi etc). I want the 'minus sign' to 'exclude' all returns

thinking sphinx ordering by mixing capitals and lower case

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 02:06:47
问题 I have a rails application that is using thinking_sphinx for the searching. My problem is that the result returned is sorted with capitals first and lower case after it at the bottom. I'd like to mix them so that both 'A' and 'a' comes before 'B'. This is the method I'm using: Company.search(query, :star => true, :page => params[:page], :per_page => 20, :order => :name, :sort_mode => :asc) 回答1: Maurício's answer is almost on the right track - but that's for transforming the text that Sphinx

failed to read searchd response

不问归期 提交于 2019-12-23 02:04:07
问题 I Got this error in Sphinx. {"status":"failed","status_message":"failed to read searchd response (status=2613, ver=11829, len=774975488, read=66)"} PHP file >> i am fallowing this tutorial <?php require_once('sphinxapi.php'); $sphinxClient = new SphinxClient(); $sphinxClient->SetServer( 'localhost', 3306 ); $sphinxClient->SetConnectTimeout( 1 ); $sphinxClient->SetFieldWeights(array('title' => 70, 'body_text' => 30)); $sphinxClient->SetMatchMode( SPH_MATCH_EXTENDED2 ); $sphinxClient->SetLimits