views:

44

answers:

1

Hey,

I'm using Ultrasphinx for searching on a Rails App. Everything seems to be working, the only thing is that the search results are not matching the search query in any way. I really don't understand this. I rebuilt my indexes and config files several times and nothing seems to work. When I perform a search for "test" I get results back without the word "test" in any column.

This only happens on my production server. In the development environment everything works fine.

I don't really know which information to provide you with, I just paste my setup in the models and controllers

# models/video.rb

is_indexed :fields => ['title', 'description', 'id'],
    :concatenate => [{:class_name => 'Tag', 
        :association_sql => "LEFT OUTER JOIN tags_videos ON (videos.id = tags_videos.video_id) LEFT OUTER JOIN tags ON (tags_videos.tag_id = tags.id)",
        :field => 'name', :as => 'tagstring'}],
    :order => "videos.created_at DESC",
    :eagerly_load => [:tags],
    :delta => true

# models/tag.rb

is_indexed :fields => ['name'],
    :delta => true


# controllers/searches_controller

class SearchesController < ApplicationController

  def search
    @search_query = (params[:query]) ? params[:query] : nil
    unless @search_query.nil?

      # set the search options
      search_options = {:query => @search_query,  
        :page => (params[:page] || 1),
        :weights => {'title' => 2.0, 'description' => 1.0, 'tagstring' => 1.0},
        :per_page => 40,  
        :class_names => ["Video"],
        :sort_mode => 'relevance'}
      @search = Ultrasphinx::Search.new(search_options)  
      Ultrasphinx::Search.client_options['ignore_missing_records'] = true
      @search.run  
      @videos = @search.results
    end
  end

end

I also get this error when running rake ultrasphinx:configure

Rebuilding configurations for production environment
Available models are Tagtranslation missing: en_US, support, array, two_words_connectorVideo
Generating SQL

but I don't know, what that has to do with it.

Thanks for your help!

A: 

I could fix the problem by installing Sphinx 0.9.9, using the option

--prefix=/usr/local/sphinx

-> http://www.sphinxsearch.com/docs/current.html#installing

After that I removed all old indexes, recreated the configuration file, recreated the index and restartet the ultrasphinx daemon.

Thanks anyway.

ole_berlin