UltraSphinx for Rails

help me please to solve it:

i have the following configuration of UltraSphinx:

config/ultrasphinx/development.conf:


sql_query =
SELECT user.id as user_id,
user.created_at as created_at,
profile.first_name as first_name,
profile.last_name as last_name,
profile.city_name as city_name,
profile.interests as interests,
country.id as country_id,
space.name as space_name,
profile_language.language_id as language_id
FROM users as user INNER JOIN my_prof as profile on
profile.user_id=user.id
LEFT OUTER JOIN my_country as country on
profile.country_id=country.id
LEFT OUTER JOIN my_space as space on space.owner_id=user.id
LEFT OUTER JOIN my_languages as profile_language on
profile_language.profile_id=profile.id
WHERE user.id >= $start AND user.id <= $end

i want implement a full text search only for the next columns:
first_name, last_name, e_mail.
But in result, for example, “Ultrasphinx::Search.new(:query =>
‘kjhui’).run” get a hash of the following keys(columns name) with
value(result query):
for example:
:user_id => 1, :created_at => ‘12.05.08’, :first_name => ‘kjhui’,
:last_name => ‘test’, :city_name => ‘Chech’, :interests => ‘football’,
:country_id => 12, :space_name => ‘street’, :language_id => 45

How can i do it?

Help me please.

Your UltraSphinx setup and the returned columns
of a query have nothing to do with each other.

The US setup only defines how US should query
the database to git it’s index values

is_indexed :fields => [first_name, last_name, e_mail],
:delta => {:field => “updated_at”}

would be all you need in your User model

@search = Ultrasphinx::Search.new(:query => ‘kjhui’)
@users = @search.run

should return the full set of columns in the users table

Thorsten M. wrote:

Your UltraSphinx setup and the returned columns
of a query have nothing to do with each other.

The US setup only defines how US should query
the database to git it’s index values

is_indexed :fields => [first_name, last_name, e_mail],
:delta => {:field => “updated_at”}

would be all you need in your User model

@search = Ultrasphinx::Search.new(:query => ‘kjhui’)
@users = @search.run

should return the full set of columns in the users table

thanks for answer,

  1. but how can i get data from other tables(my_prof, my_country,
    my_space, my_languages)?(I want to get data near as SQL query(that i
    write in config/ultrasphinx/development.conf) is returned)
  2. Can US also returned data from users, my_prof, my_country, my_space,
    my_languages also?

How can i implement this?

Help me please to solve it problem.

thanks for answer,

  1. but how can i get data from other tables(my_prof, my_country,
    my_space, my_languages)?(I want to get data near as SQL query(that i
    write in config/ultrasphinx/development.conf) is returned)
  2. Can US also returned data from users, my_prof, my_country, my_space,
    my_languages also?

How can i implement this?

Help me please to solve it problem.

I’m also wondering about this.

Is there a way to return which field(s) the search word is found in for
each User? I’ve been looking, but have not found a way to do this.