Git Product home page Git Product logo

thinking-sphinx-raspell's Introduction

Thinking Sphinx with Raspell

This library adds Aspell/Raspell support to Thinking Sphinx.

Installation

You’ll need the Aspell library (easily compiled by source, or installed via Homebrew or MacPorts). Don’t forget to install the English library as well – there’s instructions for both in Evan Weaver’s Raspell README.

Once that’s set up, grab the gem:

gem install thinking-sphinx-raspell

You’ll want to add the gem to your Gemfile:

gem 'thinking-sphinx-raspell', '1.1.2',
  :require => 'thinking_sphinx/raspell'

Or, if using older versions of Rails, your config/environment.rb file:

config.gem 'thinking-sphinx-raspell',
  :lib     => 'thinking_sphinx/raspell',
  :version => '>= 1.1.2'

Or, if you wish to do a manual require yourself:

require 'thinking_sphinx/raspell'

Usage

By default, Thinking Sphinx will not overwrite your search query, but you can view suggestions:

@articles = Article.search 'pnacakes'
@articles.suggestion? #=> true
@articles.suggestion  #=> 'pancakes'

You can also choose to redo the search using the provided suggestion:

@articles.redo_with_suggestion
@articles.each do |article|
  # ...
end

Configuration

You can customise the following settings – either in your config/environment.rb file, or perhaps in an initializer. Example syntax below highlights the current defaults.

config = ThinkingSphinx::Configuration.instance
config.raspell.dictionary             = 'en'
config.raspell.suggestion_mode        = :normal
config.raspell.options['ignore-case'] = true

You can look at the available options using the following two collections:

config = ThinkingSphinx::Configuration.instance
config.raspell.dictionaries     #=> ['en', 'en_GB', 'en_US', ... ]
config.raspell.suggestion_modes #=> [:ultra, :fast, :normal, :badspellers]

If you need more documentation, you can check out the YARD files on rdoc.info. This isn’t a big library, though – what you see in this readme is pretty much what you get.

Limitations

  • Only checks normal query strings, not field-specific queries via the :conditions hash.

Patches are very much welcome – I would like to address this last remaining limitation.

Copyright

Copyright © 2009-2011 Pat Allan. Released under an MIT licence.

thinking-sphinx-raspell's People

Contributors

pat avatar divineforest avatar spieker avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.