Hi Benjamin

I think the problem here is that you're mixing fields and attributes in 
:conditions. :with should be used for attribute filters, and :conditions for 
field queries. I'm guessing 1.10-beta has figured out you're doing the wrong 
thing, whereas 0.9.9 isn't quite so smart.

Try the following:
  Post.search 'a',
    :conditions  => {:category => 'cat1'},
    :with        => {:status => 3, :ende => 1298542357..1300961557},
    :order       => 'beginn DESC',
    :max_matches => 1000000

Although one thing to note there is that you're treating status like an 
attribute, but you're indexing it as a field. Do you expect users to search for 
'3' and get posts with a status of 3 back? If so, shift status from :with to 
:conditions in my example above. Otherwise, I'd recommend status become an 
attribute instead of a field.

Hope this helps.

-- 
Pat

On 24/02/2011, at 9:23 PM, Benjamin Bock wrote:

> It's just sphinx.conf (which is configured in sphinx.yml) and it
> contains sql_attr_uint = ende
> 
> And: It now works fine with sphinx 0.9.9 but not in 1.10-beta. I tried
> 1.10-beta using these steps:
> 
> rake ts:stop
> /etc/init.d/apache stop
> making sure using ps nothing is running
> rm config/sphinx.conf db/sphinx/*
> 
> in the directory of sphinx 1.10-beta:
> ./configure && make && make install
> 
> Then again in the rails app:
> rake ts:index
> double-checked that sql_attr_uint = ende is in the newly generated
> sphinx.conf
> rake ts:start
> then started apache (with passenger).
> 
> Then running a
> 
> Post.search
> "a", :page=>nil, :per_page=>20, :conditions=>{:status=>3, 
> :ende=>1298542357..1300961557, :category=>"cat1"}, :order=>"beginn
> DESC", :max_matches=>1000000
> 
> results in:
> 
> index post_core: query error: no field 'ende' found in schema
> 
> Now I went back to sphinx 0.9.9 (without any change in code or libs
> but with reindexing) and everything is fine.
> 
> Do you think this is a compatibility problem between TS and Sphinx
> 1.10-beta or is this a problem directly in sphinx?
> 
> 
> Conclusion: For the particular app, I'll stay with 0.9.9 which works
> now. Thanks for your help!
> Conclusion 2: Using betas is not always a good idea.
> 
> If anybody want's to look into the problem with 1.10-beta, I can maybe
> run some tests.
> 
> Benjamin
> 
> On 24 Feb., 10:12, Clemens Kofler <[email protected]> wrote:
>> Does your development.sphinx.conf (or production.sphinx.conf, depending on 
>> the environment we're talking about) contain an sql_attr_(something) = ende 
>> definition in the post_core_0 block?
>> 
>> On Feb 24, 2011, at 10:04 AM, Benjamin Bock wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi Clemens,
>> 
>>> define_index do
>>>    indexes aoderg, :as => :ad_type
>>>    indexes rubrik, :as => :category
>>>    indexes stadt, :as => :location
>>>    indexes status, email, ip
>>>    indexes [ueberschrift, text, kontakt], :as => :full_text
>>>    where 'ende > 1293750000'
>>>    has beginn, ende
>>>  end
>> 
>>> The search call which causes the exception is in fact an update call,
>>> as mentioned in the last mail:
>> 
>>> Post.update(post_id.to_i, :status => status)
>> 
>>> The search call which fails with 1.10-beta but is fine with 0.9.9 is
>> 
>>> Post.search full_text, :page => page, :per_page =>
>>> per_page, :conditions => {:ende => now.to_i..now.to_i +
>>> 4.weeks.to_i}  :order => "beginn DESC", :max_matches => 1000000
>> 
>>> The latter error does not occur if full_text is nil.
>> 
>>> - Benjamin
>> 
>>> On 23 Feb., 23:45, Clemens Kofler <[email protected]> wrote:
>>>> Hi Benjamin,
>> 
>>>> help us help you by posting the define_index block and your precise search 
>>>> call. :-)
>> 
>>>> - Clemens
>> 
>>>> On Feb 23, 2011, at 8:53 PM, Benjamin Bock wrote:
>> 
>>>>> Hi Pat et al.
>> 
>>>>> as complained on Twitter [1] two days ago I'm having some problems
>>>>> with Thinking Sphinx and/or Sphinx which I haven't been able to solve
>>>>> yet. The problems stays with both the 2.0.2 gem and the latest from
>>>>> the rails 3 branch.
>>>>> I've tried Sphinx 1.10-beta and 0.9.9.
>> 
>>>>> The error received is "searchd error (status: 1): index post_core:
>>>>> attribute 'ende' not found".
>>>>> define_index is quite at the end of the model file and there are no
>>>>> associations defined.
>> 
>>>>> With Sphinx 1.10 I cannot even search anything (same or similar error
>>>>> as above), with 0.9.9 the error occurs only when calling
>>>>> "Post.update(post_id.to_i, :status => status)"
>> 
>>>>> Do you have any idea where I could look or what I could try to solve
>>>>> this?
>> 
>>>>> Thanks in advance!
>> 
>>>>> Benjamin
>> 
>>>>> [1]https://twitter.com/bnjmnbck/status/39486194404302848
>> 
>>>>> --
>>>>> 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.
> 

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