Hi Pat,
 Thanks for the quick reply, i have added crontab rule and it is indexing
properly for the specific time as described in crontab.

"What's the contents of your sphinx.yml file? "

I don't find the file in config folder in my application path? Right now i
am running sphinx in development mode. Whether it is generated in production
mode or while installing sphinx or gem(ts)or we need to create the file ?

Note:
=====
1. When I try to 'locate' the file in my ubuntu OS, i got sphinx.yml.tpl
with the below information

"config_file: /opt/sphinx/etc/sphinx.conf
root_dir: /opt/sphinx/bin
indexes: test1 test2 "

I think it was sample file, correct me if iam wrong ?

2. I found "development.sphinx.conf" in the config file folder, it have
indexing thing (i think so).

"As for updating, if you're using delta indexing, then just follow the
instructions in the documentation:
http://freelancing-god.github.com/ts/en/deltas.html";

I have implemented the delta indexing by followed the instruction from the
above link, seems its working.

"If you get stuck, let us know... you'll still need to perform the normal
indexing (via cron or a similar tool)."
 Yes iam still stucked..

I have following issue.

"PLEASE HAVE A LOOK AT CODING - MODEL ASSOCIATION AND DEFINE_INDEX METHOD"

Model:
=====

class User < ActiveRecord::Base
    include ActionView::Helpers::UrlHelper

    has_one :profile, :class_name => "UserProfile", :dependent => :destroy

    has_many :games

    has_many :game_attributes, :dependent => :destroy do
        def game(user, gme,dt)
            find(:all, :conditions => {:user_id => user.id, :game_id =>
gme.id, :date => dt})
        end
    end

    has_and_belongs_to_many :interested_games,
        :class_name => 'Game',
        :join_table => 'interested_game_users',
        :order => 'name'

    define_index do
            indexes login
              indexes email
              indexes admin
              indexes staff
        indexes game_attributes(:name), :as => :ga_name
        indexes game_attributes.value, :as => :ga_value
        indexes profile.gender, :as => :up_gender
                how to index interested_game(which is HBTM) ? i indexed like
indexes "users.interested_games(:id), :as => :in_game_id" and like "indexes
interested_games(:name), :as => :in_game_name" is it correct ?
              has :id, created_at
       end
end

MySQL
======
Fields in the user table:
=========================
    id
    login
        email
        admin
        staff
        created_at+etc..

Fields in the user_profile table:
=================================
        id
        user_id
        gender
        first_name
        last_name
    created_at+etc..

Fields in the games:
====================
        id
        games_name
        game_desc
    created_at+etc..

Fields in the game_attributes:
==============================
        id
        user_id
        game_id
        name
        value
    created_at+etc..

records like below in game_attributes:
-------------------------------------------------------
     id     user_id game_id     name     value     created_at
     updated_at                        date
=================================================================================
    1260     143     7            mario     value1     2010-04-20 17:54:59
    2010-04-20 17:54:59     March 14, 2009
    1261     143     7            mario     value2     2010-04-20 17:54:59
    2010-04-20 17:54:59     March 14, 2009
    1262     143     7            mario     value3     2010-04-20 17:54:59
    2010-04-20 17:54:59     March 14, 2009
    1263     143     7           mario     value4    2010-04-20 17:54:59
2010-04-20 17:54:59     March 14, 2009
    1264     143     7           mario     value5    2010-04-20 17:54:59
2010-04-20 17:54:59     March 14, 2009


Fields in the interested_game_users:
====================================
    user_id
     procedure_id

Ques:
How  to form a search query for each game_attribute in combination with name
and value  from the above given fields. Assume i doing a search with the
following attributes.

Example
======
1. @results = User.search params[:search_text], :per_page => 10, :conditions
=> {:ga_name => 'mario', :ga_value=>'value1', :ga_value=>"value2",
:ga_value=> "value3", :ga_value=> "value4",:ga_value=> "value5"}, :sort_mode
=> :extended,  :order => "created_at DESC"

Means i need to compare value for an array of records for specific user and
game (refer the "records like below in game_attributes:")

I confusing like anything, Please help me on this

Note: Same scenario is working in rails 2.3.8 using acts_as_ferret,  if you
want the acts_as_ferret query, i will copy-paste here

Apart from that ,if you want any other information i will give that you in
minitues.

Thanks in Advance,
Jak


On Sun, Dec 5, 2010 at 7:07 AM, Pat Allan <[email protected]> wrote:

> Hi Jak
>
> Firstly: your first email came through - the first two posts on the mailing
> list are flagged (forced to the top), because they contain common questions.
> That seems to confuse people.
>
> Anyway, on to your questions:
>
> * You're searching on 'j', with :star set to true - but are you enabling
> either prefix or infix indexing. You need to do one or the other:
> http://freelancing-god.github.com/ts/en/common_issues.html#wildcards
>
> What's the contents of your sphinx.yml file?
>
> * As for updating, if you're using delta indexing, then just follow the
> instructions in the documentation:
> http://freelancing-god.github.com/ts/en/deltas.html
>
> If you get stuck, let us know... you'll still need to perform the normal
> indexing (via cron or a similar tool).
>
> Cheers
>
> --
> Pat
>
> On 02/12/2010, at 5:43 PM, Arun Kumar wrote:
>
> >
> > Hi team,
> >
> > This is my second mail to this group, i don't know why it is not
> published to the user group, please respond and publish it to the group....
> I am using rails 3.0 and i installed sphinx and added the following to
> gemfile  gem 'thinking-sphinx', '2.0.0', :require => 'thinking_sphinx'. If i
> generate the conditions dynamically it is not working fine (means search
> query)?
> >
> > My structure is like below:
> > ==========================
> >
> > Model:
> > =====
> >
> > class User < ActiveRecord::Base
> >     include ActionView::Helpers::UrlHelper
> >
> >     has_one :profile, :class_name => "UserProfile", :dependent =>
> :destroy
> >
> >     has_many :game_attributes, :dependent => :destroy do
> >         def game(user, gme,dt)
> >             find(:all, :conditions => {:user_id => user.id, :game_id =>
> gme.id, :date => dt})
> >         end
> >     end
> >
> >     has_and_belongs_to_many :interested_game,
> >         :class_name => 'Game',
> >         :join_table => 'interested_game_users',
> >         :order => 'name'
> >
> >     define_index do
> >             indexes login
> >               indexes email
> >               indexes admin
> >               indexes staff
> >         indexes game_attributes(:name), :as => :ga_name
> >         indexes game_attributes.value, :as => :ga_value
> >         indexes profile.gender, :as => :up_gender
> >               has :id, created_at
> >        end
> > end
> >
> > Controller:
> > ===========
> >
> > Working query:
> > =============
> > "rake ts:in RAILS_ENV=development
> > rake thinking_sphinx:rebuild RAILS_ENV=development
> > rake ts:start RAILS_ENV=development
> > rake ts:stop RAILS_ENV=development"
> >  are working fine...
> >
> >
> > When i put this query " @results = User.search '', :page =>
> params[:page], :per_page => 10 " in controller, it producing the query, i
> can able to see the results.
> >
> > [1m [36mUser Load (0.1ms) [0m  [1mSELECT `users`.* FROM `users` WHERE
> (`users`.`id` IN (272, 275, 280, 281, 282, 283, 288, 289, 290, 291)) [0m
> > @results [#<User
> #.............................................................">]
> > ==============ThinkingSphinx::Search= length==== 10
> >
> > When i try  the below query it will not generate result or produces empty
> result...... When i try this same query with rails db console it producing
> the data, so we sure that  have the data... please help me on this.
> >
> > query:
> > ======
> >   @results = User.search 'j', :page => params[:page], :per_page => 10,
> :conditions => {:ga_gender =>'Female', :login => 'Someusename', :ga_name=>
> 'some name', ga_value=>'some value'}, star =>true, :sort_mode => :extended,
>  :order => "created_at DESC"
> >
> > If i generate the conditions dynamically it is not working fine (means
> search query)?
> >
> > @results = User.search 'j', :page => params[:page], :per_page => 10,
> :conditions => {params[:symbol] =>params[:string], params[:symbols]
> =>params[:string],'}, star =>true, :sort_mode => :extended,  :order =>
> "created_at DESC"
> >
> >
> > 2. How to implement delta to update thinkg-sphinx automatically for some
> period / any document/forums , etc..
> >
> >
> > Thanks in Advance,
> > Jak
> >
> > --
> > 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]<thinking-sphinx%[email protected]>
> .
> > For more options, visit this group at
> http://groups.google.com/group/thinking-sphinx?hl=en.
>
> --
> 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]<thinking-sphinx%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/thinking-sphinx?hl=en.
>
>


-- 

Arun Kumar. J,
Software Engineer, mobile-worx ltd,www.zestadz.com
http://railsbuilder.blogspot.com
Twitter: jakthegr8 <http://twitter.com/jakthegr8>
Skype: arunisr8

-- 
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