Thinking Sphinx

Sphinx和ActiveRecord之间的一个Ruby连接器。(A Ruby connector between Sphinx and ActiveRecord.)

  • 所有者: pat/thinking-sphinx
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Thinking Sphinx 是一个用于将ActiveRecord连接到Sphinx全文搜索工具的库,并与Rails紧密集成(也可与其他Ruby Web框架一起使用)。 目前的版本是v3.4.1。

Sphinx 是一种非常快速的搜索引擎,用于索引数据,并提供灵活的搜索方式。 Thinking Sphinx 允许您将模型简单而无痛地连接到 Sphinx 中 —— 使用SQL搜索多个字段是一件令人痛苦的事,那就让我们来搞掂它吧。

概覽

名稱與所有者pat/thinking-sphinx
主編程語言Ruby
編程語言Ruby (語言數: 2)
平台
許可證MIT License
發布數56
最新版本名稱v5.5.1 (發布於 2022-12-31 20:05:08)
第一版名稱v0.9.5 (發布於 2008-05-06 09:38:24)
創建於2008-04-14 01:28:12
推送於2024-02-28 23:25:04
最后一次提交
星數1.6k
關注者數31
派生數467
提交數1.3k
已啟用問題?
問題數989
打開的問題數12
拉請求數161
打開的拉請求數3
關閉的拉請求數106
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

h1. Thinking Sphinx

Thinking Sphinx is a library for connecting ActiveRecord to the Sphinx full-text search tool, and integrates closely with Rails (but also works with other Ruby web frameworks). The current release is v4.4.1.

h2. Upgrading

Please refer to "the changelog":https://github.com/pat/thinking-sphinx/blob/develop/CHANGELOG.markdown and "release notes":https://github.com/pat/thinking-sphinx/releases for any changes you need to make when upgrading. The release notes in particular are quite good at covering breaking changes and more details for new features.

The documentation also has more details on what's involved for upgrading from "v3 to v4":https://freelancing-gods.com/thinking-sphinx/v4/upgrading.html, and "v1/v2 to v3":https://freelancing-gods.com/thinking-sphinx/v3/upgrading.html.

h2. Installation

It's a gem, so install it like you would any other gem. You will also need to specify the mysql2 gem if you're using MRI, or jdbc-mysql if you're using JRuby:

The MySQL gems mentioned are required for connecting to Sphinx, so please include it even when you're using PostgreSQL for your database. If you're using JRuby with a version of Sphinx prior to 2.2.11, there is "currently an issue with Sphinx and jdbc-mysql 5.1.36 or newer":http://sphinxsearch.com/forum/view.html?id=13939, so you'll need to stick to nothing more recent than 5.1.35, or upgrade Sphinx.

You'll also need to install Sphinx - this is covered in "the extended documentation":https://freelancing-gods.com/thinking-sphinx/installing_sphinx.html.

h2. Usage

Begin by reading the "quick-start guide":https://freelancing-gods.com/thinking-sphinx/quickstart.html, and beyond that, "the documentation":https://freelancing-gods.com/thinking-sphinx/ should serve you pretty well.

h2. Requirements

The current release of Thinking Sphinx works with the following versions of its dependencies:, _. Library, _. Minimum, _. Tested Against, Ruby, v2.3, v2.3.8, v2.4.5, v2.5.3, v2.6.1, Sphinx, v2.1.2, v2.1.9, v2.2.11, v3.0.3, v3.1.1, Manticore, v2.6.3, v2.6.4, v2.7.5, v2.8.1, ActiveRecord, v3.2, v3.2..v6.0, It might work with older versions of Ruby, but it's highly recommended to update to a supported release.

It should also work with JRuby, but the test environment on Travis CI has been timing out, hence that's not actively tested against at the moment.

h3. Sphinx or Manticore

Thinking Sphinx v3 is currently built for Sphinx 2.1.2 or newer, or Manticore v2.6+.

h3. Rails and ActiveRecord

Currently Thinking Sphinx 3 is built to support Rails/ActiveRecord 3.2 or newer. If you're using Sinatra and ActiveRecord instead of Rails, that's fine - just make sure you add the @:require => 'thinking_sphinx/sinatra'@ option when listing @thinking-sphinx@ in your Gemfile.

Please note that if you're referring to polymorphic associations in your index definitions, you'll want to be using Rails/ActiveRecord 4.0 or newer. Supporting polymorphic associations and Rails/ActiveRecord 3.2 is problematic, and likely will not be addressed in the future.

If you want ActiveRecord 3.1 support, then refer to the 3.0.x releases of Thinking Sphinx. Anything older than that, then you're stuck with Thinking Sphinx v2.x (for Rails/ActiveRecord 3.0) or v1.x (Rails 2.3). Please note that these older versions are no longer actively supported.

h3. Ruby

You'll need either the standard Ruby (v2.3 or newer) or JRuby (9.1 or newer).

h3. Database Versions

MySQL 5.x and Postgres 8.4 or better are supported.

h2. Contributing

Please note that this project has a "Contributor Code of Conduct":http://contributor-covenant.org/version/1/0/0/. By participating in this project you agree to abide by its terms.

To contribute, clone this repository and have a good look through the specs - you'll notice the distinction between acceptance tests that actually use Sphinx and go through the full stack, and unit tests (everything else) which use liberal test doubles to ensure they're only testing the behaviour of the class in question. I've found this leads to far better code design.

All development is done on the @develop@ branch; please base any pull requests off of that branch. Please write the tests and then the code to get them passing, and send through a pull request.

In order to run the tests, you'll need to create a database named @thinking_sphinx@:

You can then run the unit tests with @rake spec:unit@, the acceptance tests with @rake spec:acceptance@, or all of the tests with just @rake@. To run these with PostgreSQL, you'll need to set the @DATABASE@ environment variable accordingly:

h2. Licence

Copyright (c) 2007-2019, Thinking Sphinx is developed and maintained by Pat Allan, and is released under the open MIT Licence. Many thanks to "all who have contributed patches":https://github.com/pat/thinking-sphinx/contributors.

去到頂部