标签: thinking-sphinx

思考sphinx未知类型'mysql'; 跳绳

我使用的是ts版本2.0.5,rails 3.0.9和mysql2 0.2.11

当尝试使用rake ts:index创建索引时,出现以下错误:

ERROR: source 'technical_core_0': unknown type 'mysql'; skipping.
Run Code Online (Sandbox Code Playgroud)

我的development.sphinx.conf包含:

source technical_core_0
{
  type = mysql
  sql_host = localhost
  sql_user = root
  sql_pass = 
  sql_db = ps_development
  sql_sock = /tmp/mysql.sock
  sql_query_pre = SET NAMES utf8
  sql_query_pre = SET TIME_ZONE = '+0:00'
  sql_query = SELECT SQL_NO_CACHE `technicals`.`id` * CAST(1 AS SIGNED) + 0 AS `id` , `orders`.`name` AS `author`, `technicals`.`id` AS `sphinx_internal_id`, 0 AS `sphinx_deleted`, 488243725 AS `class_crc`, IFNULL(`orders`.`name`, '') AS `author_sort`, `technicals`.`order_id` AS `order_id`, UNIX_TIMESTAMP(`technicals`.`created_at`) AS `created_at`, …
Run Code Online (Sandbox Code Playgroud)

ruby thinking-sphinx ruby-on-rails-3

19
推荐指数
2
解决办法
7583
查看次数

像Sphinx这样的全文搜索服务器如何工作?

任何人都可以用简单的语言解释像Sphinx这样的全文服务器是如何工作的?在纯SQL中,可以使用这样的SQL查询来搜索文本中的某些关键字:

select * from items where name like '%keyword%';
Run Code Online (Sandbox Code Playgroud)

但是在各种Sphinx插件生成的配置文件中,我根本看不到任何类似的查询.它们包含如下所示的SQL语句,它们似乎将搜索划分为不同的ID组:

SELECT (items.id * 5 + 1) AS id, ... 
       WHERE items.id >= $start AND items.id <= $end 
       GROUP BY items.id
..
SELECT * FROM items WHERE items.id = (($id - 1) / 5)
Run Code Online (Sandbox Code Playgroud)

它可以用简单的词语解释这些查询是如何工作的以及它们是如何生成的?

sql full-text-search sphinx search-engine thinking-sphinx

19
推荐指数
1
解决办法
7891
查看次数

配置思维狮身人面像和飞行狮身人面像时出错

我在Heroku上运行Rails 3应用程序.我正在使用Thinking Sphinx搜索引擎进入我的应用程序.为了使它与Heroku一起工作,我flying-sphinx按照Heroku文档中的建议为我的gemfile 添加了一个gem.

这就是我在gemfile中的内容

gem 'thinking-sphinx', '2.0.11' 
gem 'flying-sphinx',   '0.7.0'
Run Code Online (Sandbox Code Playgroud)

根据这里提到的步骤https://devcenter.heroku.com/articles/flying_sphinx,添加了fly-sphinx插件(Heroku插件:添加flying_sphinx:木制)后,当我运行heroku运行fly-sphinx配置时出现以下错误:


/app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.0/lib/flying_sphinx/sphinx_configuration.rb:2:in 'initialize': uninitialized constant FlyingSphinx::SphinxConfiguration::ThinkingSphinx (NameError)
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.0/lib/flying_sphinx/cli.rb:31:in 'new'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.0/lib/flying_sphinx/cli.rb:31:in 'configure'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.0/lib/flying_sphinx/cli.rb:20:in 'block in run'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.0/lib/flying_sphinx/cli.rb:20:in 'each'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.0/lib/flying_sphinx/cli.rb:20:in 'all?'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.0/lib/flying_sphinx/cli.rb:20:in 'run'
    from /app/vendor/bundle/ruby/1.9.1/gems/flying-sphinx-0.8.0/bin/flying-sphinx:5:in ''
    from vendor/bundle/ruby/1.9.1/bin/flying-sphinx:19:in 'load'
    from vendor/bundle/ruby/1.9.1/bin/flying-sphinx:19:in ''

我无法继续前进.

ruby sphinx thinking-sphinx ruby-on-rails-3

11
推荐指数
1
解决办法
380
查看次数

如何在rails应用程序中运行rake任务

我想做的事:

在model.rb中,在after_commit中,我想运行rake task ts:reindex

ts:reindex通常使用rake ts:index运行

ruby rake ruby-on-rails thinking-sphinx

10
推荐指数
1
解决办法
9185
查看次数

在sphinx中使用main和delta索引

我在我的网站上搜索全文搜索到sphinx.我将使用SphinxSE来执行搜索.

我创建了2个索引,如手册中所述:http://www.sphinxsearch.com/docs/manual-0.9.9.html#live-updates

它似乎工作,并在其自己的索引中索引不同的东西,但我有点困惑我应该如何处理索引更新,合并和重建.

我理解的方式是我每隔5分钟左右运行"indexer delta --rotate",这会向索引添加新的提交.然后每天一次,我会通过运行"indexer main delta --rotate"将delta索引合并到主索引中.然后一个月左右,我将运行"indexer --all"来重建所有索引.

我这样做是对,还是我错过了什么?

php sphinx thinking-sphinx

10
推荐指数
1
解决办法
2134
查看次数

如何在Thinking Sphinx搜索中添加条件"IS NOT NULL"

我正在使用Thinking Sphinx进行全文搜索,关注此视频.

我想做以下事情:

@articles = Article.search(params[:search], :conditions => "published_at IS NOT NULL", :order => :created_at)
Run Code Online (Sandbox Code Playgroud)

问题是这不起作用.似乎搜索方法只接受哈希条件.我已经尝试了几种方法,但我对如何将"published_at IS NOT NULL"表示为哈希表示无能为力......

ruby full-text-search sphinx ruby-on-rails thinking-sphinx

9
推荐指数
1
解决办法
8557
查看次数

如何在Rails 3应用程序中实现更快的搜索范围(SAYT)api

我的mysql数据库中有数百万条记录.我在Rails 3中为iPhone应用程序实现了一个普通的REST api,但是SAYT功能响应非常慢.搜索数据库并返回结果需要花费大量时间.如何提高性能?

我索引了我的桌子.我应该将所有方面看作是MySQL调优,还是应该使用rails sphinx或sunspot?这会有所帮助请帮助我提供所有专业建议.

mysql api thinking-sphinx ruby-on-rails-3 sunspot-rails

9
推荐指数
1
解决办法
1726
查看次数


思维狮身人面像无法启动 - "无法启动searchd守护程序"

我尝试在我的服务器上开始思考sphinx,但它不想工作.

我做:

$ rake thinking_sphinx:index && rake thinking_sphinx:start
Run Code Online (Sandbox Code Playgroud)

我得到:

Generating Configuration to /vol/www/apps/ror_tutorial/releases/20120202111730/config/development.sphinx.conf
Sphinx 2.0.3-release (r3043)
Copyright (c) 2001-2011, Andrew Aksyonoff
Copyright (c) 2008-2011, Sphinx Technologies Inc (http://sphinxsearch.com)

using config file '/vol/www/apps/ror_tutorial/releases/20120202111730/config/development.sphinx.conf'...
indexing index 'micropost_core'...
WARNING: collect_hits: mem_limit=0 kb too low, increasing to 13568 kb
collected 0 docs, 0.0 MB
total 0 docs, 0 bytes
total 0.008 sec, 0 bytes/sec, 0.00 docs/sec
skipping non-plain index 'micropost'...
indexing index 'user_core'...
WARNING: collect_hits: mem_limit=0 kb too low, increasing to 13568 kb
collected …
Run Code Online (Sandbox Code Playgroud)

sphinx thinking-sphinx ruby-on-rails-3.1 ruby-1.9.3

8
推荐指数
2
解决办法
1万
查看次数

mysql2的未定义方法`next_result'(rails 3)

我曾经使用该软件的第二个版本,没有任何问题.在我的上一次申请中,我决定使用最新的"思考 - 狮身人面像".我有一个奇怪的错误.

> NoMethodError in Adverts#index undefined method `next_result' for
> #<Mysql2::Client:0xac86a54>
Run Code Online (Sandbox Code Playgroud)

我的宝石文件

    gem 'rails', '3.2.11'
    gem 'pg', '0.14.0'  # My database

# for sphinx
                gem "mysql2", "~> 0.3.11"
                gem "thinking-sphinx", "~> 3.0.0"
Run Code Online (Sandbox Code Playgroud)

索引:

ThinkingSphinx::Index.define :car, :with => :active_record do
   has user_id, model_id, city_id, area_id, engine_id, mileage
  end
Run Code Online (Sandbox Code Playgroud)

thinking_sphinx.yml

    development:
      port: 9312
    test:
      port: 9313
    production:
      port: 9312
Run Code Online (Sandbox Code Playgroud)

控制器:

class AdvertsController < ApplicationController
  def index
    @cars = Car.by_model_id(@model_id)
  end
end
Run Code Online (Sandbox Code Playgroud)

模型:

class Car < ActiveRecord::Base
    include ThinkingSphinx::Scopes

    sphinx_scope(:by_model_id) { …
Run Code Online (Sandbox Code Playgroud)

sphinx ruby-on-rails thinking-sphinx ruby-on-rails-3

8
推荐指数
1
解决办法
729
查看次数