Hi there

Firstly, you could target your search to the emp_name field.

Then I think the only option to you is to group your results by
organisation (:group_by 
http://freelancing-god.github.com/ts/en/searching.html#grouping),
displaying the number of employees found using
each_with_groupby_and_count. This will return a list of organisations
that have an emp_name matching the search string and the count of how
many matches are within the group.

I may be wrong though as I'm quite new to Sphinx and TS.

Shaun



On Jan 19, 7:49 pm, upender <[email protected]> wrote:
> Hello everybody,
>  I have two models named Organization and Employee with following
> relation.
>
> class Organization < ActiveRecord::Base
>   has_many :employees
>      define_index do
>     #sphinx fields
>     indexes title
>     indexes adress
>     indexes employees.name,:as => :emp_name
>     indexes employees.designation,:as => :emp_designation
>   end
> end
>
> When i try to search for the results that match the list of all the
> employees that belongs to the organization,
> i successfully achieved in displaying the organization search results
> but i want to display the employee name and designation under a
> particular organization. How should i iterate to achieve this in my
> view file?
>
> This was my query
>
> �...@organizations = Organization.search('Smith',:page => params
> [:page], :per_page =>2,:excerpts => true)
>
> Where Smith is the employee name.
>
> I have the more number of employees with the same name.
>
> When i search for Smith, i want to achieve the results of all the
> names and designations of Smith under various Organizations.
>
> Hope someone would help me out in solving this problem.
>
> Thanks in advance.
-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.


Reply via email to