thinking-sphinx

Thinking Sphinx not working in test mode

I'm trying to get Thinking Sphinx to work in test mode in Rails. Basically this: ThinkingSphinx::Test.init ThinkingSphinx::Test.start freezes and never comes back. My test and devel configuration is the same for test and devel: dry_setting: &dry_setting adapter: mysql host: localhost encoding: utf8 username: rails password...

Grouping search results with thinking_sphinx plugin for rails

I can use the following to group results, but it only returns one result per group. @results = Model.search params[:search_query], :group_by => 'created_at', :group_function => :day, :page => params[:page], :per_page =>...

Search french via Thinking Sphinx in ROR project

Hello everyone: How can I use sphinx to search french words which the entries in the db is actually english? The situation is: I have a ROR project with a table in the db called "categories", and the category names are in english, category has many "question" entries. In localization file config/locals/fr.yml, these categories were t...

Search Issue by using sphinx in ROR project

Hello everyone: I have a ROR Project with db structure like this: class Business has_many :business_categories, :include => :business, :conditions => ["businesses.version = business_categories.version"] has_many :categories, :through => :business_categories, :source => :category end class Category has_many :business_cate...

Am I reindexing this Sphinx index correctly?

According to the Thinking Sphinx docs... Turning on delta indexing does not remove the need for regularly running a full re-index ... So I set up this cron job... 50 10 * * * cd /var/www/my_app/current && /opt/ruby/bin/rake thinking_sphinx:index RAILS_ENV=production >> /var/www/my_app/current/log/reindexing.log 2>&1 Is...

Assign weight to a integer column for Sphinx search

Hello: I have a note table with columns: title :string content :text rating :integer and a thinking_sphinx configuration: define_index do indexes :title, :sortable => true indexes :content end Then I can search the notes and assign weights to title and content to define the order or the result: Note.search "abc", :match_mode...

Rails paginate existing array of ActiveRecord results

Hello, I generally use will_paginate for the pagination in my app, but have hit a stumbler on my search feature. I'm using Thinking Sphinx for doing my full-text search, which returns results paginated. The problem I'm having is that after I've received the results from Thinking Sphinx, I need to merge them with some other results and r...

Thinking Sphinx with Rails - Delta indexing seems to work fine for one model but not for the other

I have 2 models User and Discussion. I have defined the indices for the models as below: For the User model: define_index do indexes email indexes first_name indexes last_name, :sortable => true indexes groups(:name), :as => :group_names has "IF(email_confirmed = true and status = 'approved', true, false)", :as => :approved_user, :typ...

Make Sphinx quiet (non-verbose)

I'm using Sphinx through Thinking Sphinx in a Ruby on Rails project. When I create seed data and all the time, it's quite verbose, printing this: using config file '/Users/pupeno/projectx/config/development.sphinx.conf'... indexing index 'user_delta'... collected 7 docs, 0.0 MB collected 0 attr values sorted 0.0 Mvalues, 100.0% done sor...

Thinking-sphinx and relevance or similarity score

Does someone know if there is a way to get the raw relevance or similarity score between a query and a result when using sphinx in general or thinking-sphinx as a wrapper? Any help is greatly appreciated. ...

Dynamic fields with Thinking Sphinx

Hi! I'm building an application where I have products and categories. Category has_many properties and each property has a list of possible values. After a category is set to the product all properties show up in the form and the user can set that property to one of the properties possible values. My question is: Is it possible for Th...

Thinking Sphinx - sorting by a string attribute gets out of sync when changes are made

I have a "restaurants" table with a "name" column. I've defined the following index: indexes "REPLACE(UPPER(restaurants.name), 'THE ', '')", :as => :restaurant_name, :sortable => true ... because I want to sort the restaurant names without respect to the prefix "The ". My problem is that whenever one of these records is updated (in ...

Problem running Thinking Sphinx with Rails 2.3.5

Hi, I just installed Sphinx (distro: archlinux) downloading the source. Then I installed "Thinking Sphinx" plugin for Rails. I followed the official page setup and this Screencast from Ryan Bates, but when I try to index the models it gives me this error: $ rake thinking_sphinx:index (in /home/benoror/Dropbox/Proyectos/cotizahoy) Sph...

Thinking sphinx, has_one association

Hi, anybody, please, help me with Thinking_sphinx configuration. I have table profile1, which has_one profile2 and profile3. So i just need to index them both, but i can't. I tried indexes name indexes profile2(:name), :as => :profile2_name indexes profile3(:name), :as => :profile3_name has id What i m doing wrong? Thanks. ...

Thinking Sphinx, complex sorting - how can I combine extended sort with expr sort?

I want to sort by expression, then by some attribute ascending, then by another attribute ascending. Something like this: :order => "(a < some constant) desc, b asc, c asc". How to get it? Extended sorting refuses to work because of <. Expr fails because of commas. I have managed to produce sorting equivalent to :order => "(a < some co...

Is it possible to use Sphinx search with dynamic conditions?

In my web app I need to perform 3 types of searching on items table with the following conditions: items.is_public = 1 (use title field for indexing) - a lot of results can be retrieved(cardinality is much higher than in other cases) items.category_id = {X} (use title + private_notes fields for indexing) - usually less than 100 results...

Rolling up search result counts to a parent category

Note: I'm having a hard time explaining this, so please ask questions and I'll try to refine the problem as much as possible. Assuming I have the following category structure: - Planets - Earth - Mars And the following items/categories (nevermind that some of them don't logically make sense): - Item #1 - Category: Planet -...

How to restrict text search to a certain subset of the database ?

I have a large central database of around 1 million heavy records. In my app, for every user I would have a subset of rows from central table, which would be very small (probably 100 records each).When a particular user has logged in , I would want to search on this data set only. Example: Say I have a central database of all cars in t...

Thinking Sphinx with a date range

Hi, I am implementing a full text search API for my rails apps, and so far have been having great success with Thinking Sphinx. I now want to implement a date range search, and keep getting the "bad value for range" error. Here is a snippet of the controller code, and i'm a bit stuck on what to do next. @search_options = { :page ...

Thinking sphinx not rendering results in order of 'relevance'

Thinking sphinx documentation says that it automatically sorts the results based on relevance. What is its relevance metric ? How can we define our own relevance metric for the system ? Example : I have a db in which one entry is Windows XP & it contains a reference to Microsoft. I also have an entry for Microsoft itself. So when I quer...