Hi Pat,

I found the issue..the owner_id column was incorrectly set to
varchar(255). Once I update it, and use the CRC workaround, hopefully
things should work out.

Thanks for your help.

On Nov 20, 5:15 pm, Pat Allan <[email protected]> wrote:
> Something does seem wrong, but just to confirm - what's the output of:
>   select count(0) from contacts where owner_id = 1573 and deleted = 0;
>
> And from Sphinx's perspective:
>   Contact.search('test contact',
>     :order => "first_name asc",
>     :with  => {:deleted => 0, :owner_id => 1573},
>     :star  => true}
>   ).results
>
> That's the raw Sphinx results - is there a warning or error?
>
> --
> Pat
>
> On 21/11/2010, at 12:09 PM, gmoniey wrote:
>
>
>
>
>
>
>
> > Hi Pat,
>
> > I tried removing some filters (and use only integers, but I still get
> > 0 results):
>
> >>> Contact.search('test contact', {:order=>"first_name asc", 
> >>> :with=>{:deleted => 0, :owner_id => 1573}, :star=>true})
> >  Sphinx   Querying:  '*test* *contact*'
> >  Sphinx (0.005495s)   Found 0 results
> > => []
>
> > I've made sure to run ts:rebuild to ensure that the latest changes to
> > define_index have been picked up, but it still returning 0 results.
> > I'm at a bit of a loss here, since the deleted flag works as expected.
> > I've double checked the db, and owner_id is correctly set:
>
> > mysql> select count(0) from contacts where owner_id = 1573;
> > +----------+
> > | count(0) |
> > +----------+
> > |        8 |
> > +----------+
> > 1 row in set (0.01 sec)
>
> > On Nov 19, 5:11 pm, Pat Allan <[email protected]> wrote:
> >> I'm pretty sure the issue is that you're trying to filter on a string - 
> >> and sadly that isn't psosible just yet (though I think that will change 
> >> once TS supports the new Sphinx 1.10-beta features.
>
> >> Have a read through this for a 
> >> workaround:http://freelancing-god.github.com/ts/en/common_issues.html#string_fil...
>
> >> Cheers
>
> >> --
> >> Pat
>
> >> On 20/11/2010, at 8:55 AM, gmoniey wrote:
>
> >>> I'm struggling to get a simple :with clause to work. I can use the
> >>> with clause to exclude soft deleted items without any problems as
> >>> such:
>
> >>>>> Contact.search('test contact', {:order=>"first_name asc", 
> >>>>> :with=>{:deleted => 0}, :star=>true})
> >>>  Sphinx   Querying: '*test* *contact*'
> >>>  Sphinx (0.005511s)   Found 1 results
> >>>  Contact Load (0.4ms)   SELECT * FROM `contacts` WHERE
> >>> (`contacts`.`id` IN (2595) AND `contacts`.`deleted` = 0)
> >>> => [#<Contact id: 2595, first_name: "test", last_name: "contact",
> >>> email: "[email protected]", phone: nil, fax: nil, title: nil, street:
> >>> nil, city: nil, state: nil, zip: nil, country: nil, owner_table:
> >>> "companies", owner_id: "1573", user_id: 21, delta: false, deleted:
> >>> false, created_at: "2010-11-10 01:38:00", updated_at: "2010-11-10
> >>> 01:38:00">]
>
> >>> However, when I add additional fields to the with clause, the query
> >>> returns 0 results:
>
> >>>>> Contact.search('test contact', {:order=>"first_name asc", 
> >>>>> :with=>{:deleted => 0, :owner_table => "companies", :owner_id => 1573}, 
> >>>>> :star=>true})
> >>>  Sphinx   Querying:  '*test* *contact*'
> >>>  Sphinx (0.003964s)   Found 0 results
> >>> => []
>
> >>> I've tried different variations of the with clause, but it always
> >>> returns 0 results. My define_index block looks like:
>
> >>>  define_index do
> >>>    indexes :first_name, :sortable => true
> >>>    indexes :last_name, :sortable => true
> >>>    indexes :email, :sortable => true
>
> >>>    has :deleted, :owner_table, :owner_id
> >>>    set_property :delta => :delayed
> >>>    set_property :field_weights => {:first_name => 10, :last_name =>
> >>> 7, :email => 5 }
> >>>  end
>
> >>> I'm using the following:
>
> >>> rails (2.3.4)
> >>> thinking-sphinx (1.3.20)
> >>> ts-delayed-delta (1.1.1)
> >>> Sphinx 0.9.9-release (r2117)
>
> >>> Any ideas? Thanks.
>
> >>> --
> >>> 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 
> >>> athttp://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].
> > For more options, visit this group 
> > athttp://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].
For more options, visit this group at 
http://groups.google.com/group/thinking-sphinx?hl=en.

Reply via email to