François
Does :with work and :conditions not? If so, that's a bug and I can fix
it... otherwise, we need to look into how Sphinx is storing null
datetimes:
- Do a search using text which only exists in an instance which isn't
archived:
parties = Party.search "something special"
- Look at the Sphinx results:
parties.results[:matches].first[:attributes]
archived_at should be in there - what's the value?
Cheers
--
Pat
On 09/10/2008, at 1:28 PM, François Beausoleil wrote:
>
> OH!
>
> It's a :with vs :conditions thing, right?
>
> I asked Pat before finding this group, and he replied:
>
>> Hi François
>> Sphinx stores nils/NULLs as 0’s – and datetimes as timestamps (ie:
>> integers) so they’ll be 0’d as well – so give the following a shot:
>> Party.search(:with => {:archived_at => 0})
>> (:conditions instead of :with will work as well, I just usually
>> keep attribute filters in :with, field filters in :conditions).
>
> So, why would :with work, while :conditions doesn't?
>
> Thanks!
> François
>
> On 9 oct, 01:49, James Healy <[EMAIL PROTECTED]> wrote:
>> François Beausoleil wrote:
>>> Party.search("beausoleil", :conditions => {:archived_at => nil})
>>> Party.search("beausoleil", :conditions => {:archived_at => 0})
>>
>>> Both of these fail and return models which are archived.
>>
>>> Does anybody have any ideas how I can exclude those models from my
>>> search results?
>>
>> try:
>>
>> Party.search("beausoleil", :with => {:archived_at => 0})
>>
>> -- James Healy <jimmy-at-deefa-dot-com> Thu, 09 Oct 2008 16:47:56
>> +1100
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---