Ah, sorry, remove :page as well:
facets = Image.facets(keywords, cearch.except(:page, :per_page))
On 16/07/2013, at 10:13 PM, Patrick Lamotte wrote:
> yes you're right, but I tried with except and recreating cearch without the
> per_page option and i've got the same error with offset and max_matches equal
> to the config file
> ThinkingSphinx::SphinxError (query 0 error: offset out of bounds
> (offset=10000, max_matches=10000); query 1 error: offset out of bounds
> (offset=10000, max_matches=10000)):
>
> Le 16 juil. 2013 à 13:29, Pat Allan a écrit :
>
>> There's not much point passing :per_page into the facet call - it's going to
>> grab all the results in one hit anyway (hence why it's picking up on the
>> max_matches value).
>>
>> So, instead of "facets = Image.facets(keywords, cearch)", try "facets =
>> Image.facets(keywords, cearch.except(:per_page))".
>>
>> On 16/07/2013, at 8:37 PM, Patrick Lamotte wrote:
>>
>>> cearch[:per_page] = val_def_ppage #user default
>>> cearch[:per_page] = @current_params["per_page"].to_i if
>>> @current_params["per_page"] #unless it was changed in the search
>>> cearch[:page] = params["page"].to_i if params["page"]
>>>
>>> keywords = @current_params["key_words"] ?
>>> Pixways::SearchesHelper.filter_keywords(@current_params["key_words"]) : ''
>>> cearch[:match_mode] = :extended
>>> @medias = Image.search(keywords, cearch)
>>>
>>> @medias.context[:panes] << ThinkingSphinx::Panes::ExcerptsPane
>>> @nb_images = {}
>>> facets = Image.facets(keywords, cearch)
>>> @nb_images = facets[:provider_id]
>>>
>>> the error is in the last line @nb_images = facets[:provider_id]
>>>
>>> indices => image_index.rb
>>> ThinkingSphinx::Index.define(:image, :with => :active_record, :delta =>
>>> ThinkingSphinx::Deltas::DelayedDelta) do
>>> indexes :title, :subject ...
>>> # attributes
>>> has :ratio, :reception_date ...
>>> has :provider_id, :facet => true
>>>
>>>
>>>
>>> Le 16 juil. 2013 à 12:27, Pat Allan a écrit :
>>>
>>>> Can you share with us the full facet search call?
>>>>
>>>> On 16/07/2013, at 7:02 PM, Patrick Lamotte wrote:
>>>>
>>>>> Hi Pat,
>>>>>
>>>>> Yes it happens only when one tries to show page 2, so there is a :page
>>>>> option in the search.
>>>>> max_matches is set up in the config file, but not in the search, I tried
>>>>> to pass max_matches in the search, it's ok for the first page but same
>>>>> error offset out of bounds with max_matches number set up in the search,
>>>>> instead of per_page option.
>>>>> It works fine with TS 3.0.3 and it's only when facets are requested, text
>>>>> searches work fine.
>>>>> Thanks, regards
>>>>>
>>>>> Patrick
>>>>>
>>>>> Le 16 juil. 2013 à 01:42, Pat Allan a écrit :
>>>>>
>>>>>> Hi Patrick
>>>>>>
>>>>>> Are you passing in a :page or :offset option to your search? It looks
>>>>>> like it's trying to request the second page of results, but there's only
>>>>>> one, due to max_matches being set to the largest possible page size.
>>>>>>
>>>>>> So, if you are using :page or :offset, remove that option, see if that
>>>>>> helps.
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>> --
>>>>>> Pat
>>>>>>
>>>>>> On 16/07/2013, at 12:39 AM, Patrick Lamotte wrote:
>>>>>>
>>>>>>> Hi Pat,
>>>>>>>
>>>>>>> I updated to 3.0.4, but I still got an error with facets
>>>>>>> ThinkingSphinx::SphinxError (query 0 error: offset out of bounds
>>>>>>> (offset=20, max_matches=20); query 1 error: offset out of bounds
>>>>>>> (offset=20, max_matches=20)):
>>>>>>>
>>>>>>> 20 is results per page(if I choose 40 then error will offset=40,
>>>>>>> max_matches=40)
>>>>>>> if I set max_matches and limit in the search, to 1000 for instance,
>>>>>>> then same error with offset=1000, max_matches=1000
>>>>>>>
>>>>>>> No problem with text searches, any idea ?
>>>>>>>
>>>>>>> Thanks, regards
>>>>>>>
>>>>>>> Patrick
>>>>>>>
>>>>>>> Le 14 juin 2013 à 04:58, Pat Allan a écrit :
>>>>>>>
>>>>>>>> Just pushed a fix, it'll be part of 3.0.4 when that gets released :)
>>>>>>>>
>>>>>>>> On 14/06/2013, at 12:58 AM, Patrick Lamotte wrote:
>>>>>>>>
>>>>>>>>> ok, don't worry
>>>>>>>>> Thanks for answering so quickly everytime
>>>>>>>>> Best
>>>>>>>>> Patrick
>>>>>>>>>
>>>>>>>>> Le 13 juin 2013 à 16:56, Pat Allan a écrit :
>>>>>>>>>
>>>>>>>>>> Just looked at the v1/v2 source, I was setting max_matches/limit
>>>>>>>>>> then, but I'm not with the v3 branch - I'll need to fix that! In the
>>>>>>>>>> meantime, using those options will deal with the problem.
>>>>>>>>>>
>>>>>>>>>> Sorry for the hassle.
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Pat
>>>>>>>>>>
>>>>>>>>>> On 14/06/2013, at 12:53 AM, Patrick Lamotte wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi Pat,
>>>>>>>>>>> Thanks, it worked that way, but is it the good way to do it now ?
>>>>>>>>>>> it worked before with v2 ?
>>>>>>>>>>> Thanks again,best regards
>>>>>>>>>>>
>>>>>>>>>>> Patrick
>>>>>>>>>>>
>>>>>>>>>>> Le 13 juin 2013 à 16:33, Pat Allan a écrit :
>>>>>>>>>>>
>>>>>>>>>>>> Hi Patrick
>>>>>>>>>>>>
>>>>>>>>>>>> Can you try setting max_matches and limit in your search call to
>>>>>>>>>>>> 1000?
>>>>>>>>>>>>
>>>>>>>>>>>> Image.facets(
>>>>>>>>>>>> :with => {:provider_id => provs_list},
>>>>>>>>>>>> :max_matches => 1000,
>>>>>>>>>>>> :limit => 1000
>>>>>>>>>>>> )
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Pat
>>>>>>>>>>>>
>>>>>>>>>>>> On 13/06/2013, at 7:21 PM, pix_plm wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>> I am having problems with facets after updating to TS V3, for
>>>>>>>>>>>>> some reason facets don't return all parameters and I don't
>>>>>>>>>>>>> understand what are the criterias ?
>>>>>>>>>>>>> I use facets to get number of images per provider (provider_id),
>>>>>>>>>>>>> calling Image.facets :with { :provider_id => provs_list }
>>>>>>>>>>>>>
>>>>>>>>>>>>> facets.inspect => ****
>>>>>>>>>>>>> #<ThinkingSphinx::FacetSearch:0x00000006bc1ff0
>>>>>>>>>>>>> @options={:with=>{:provider_id=>[99, 92, 150, 28, 116, 170, 45,
>>>>>>>>>>>>> 25, 74, 21, 3, 55, 12, 71, 93, 27, 79, 98, 52, 152, 65, 151, 38,
>>>>>>>>>>>>> 155, 115, 161, 53, 124, 106, 4, 133, 68, 156, 121, 134, 39, 117,
>>>>>>>>>>>>> 86, 26, 48, 67, 13, 167, 33, 162, 34, 22, 85, 15, 90, 47, 69, 18,
>>>>>>>>>>>>> 168, 163, 147, 153, 166, 59, 63, 131, 75, 154, 105, 41, 64, 119,
>>>>>>>>>>>>> 139, 84, 118, 94, 107, 96, 31, 113, 165, 40, 149, 35, 158, 8, 70,
>>>>>>>>>>>>> 112, 76, 97, 17, 109, 145, 137, 110, 11, 58, 7, 43, 16, 51, 1,
>>>>>>>>>>>>> 50, 10, 83, 36, 102, 169, 159, 111, 123, 19, 91, 66, 101, 160],
>>>>>>>>>>>>> :content_error=>0}, :classes=>[Image(id: integer, ...)]},
>>>>>>>>>>>>> @query=nil, @hash={}>
>>>>>>>>>>>>>
>>>>>>>>>>>>> results :
>>>>>>>>>>>>> facets[:provider_id] => {4=>167153, 7=>185846, 10=>26215,
>>>>>>>>>>>>> 13=>88504, 17=>617844, 16=>53911, 18=>105185, 19=>12223,
>>>>>>>>>>>>> 21=>361506, 15=>59375, 26=>261693, 25=>27155, 27=>156428,
>>>>>>>>>>>>> 33=>553155, 31=>129199, 34=>719638, 22=>151379, 35=>3216,
>>>>>>>>>>>>> 36=>126032, 38=>19279}
>>>>>>>>>>>>>
>>>>>>>>>>>>> I don't understand why I don't get all providers results ?
>>>>>>>>>>>>>
>>>>>>>>>>>>> I am running rails 3.2.13, ts 3.0.3, sphinx 2.0.7
>>>>>>>>>>>>>
>>>>>>>>>>>>> indices for Image Model
>>>>>>>>>>>>>
>>>>>>>>>>>>> ThinkingSphinx::Index.define(:image, :with => :active_record,
>>>>>>>>>>>>> :delta => ThinkingSphinx::Deltas::DelayedDelta) do
>>>>>>>>>>>>> indexes :title, :subject, ...
>>>>>>>>>>>>> # attributes
>>>>>>>>>>>>> has :ratio, :reception_date ...
>>>>>>>>>>>>> has :provider_id, :facet => true
>>>>>>>>>>>>> end
>>>>>>>>>>>>>
>>>>>>>>>>>>> Any idea ?
>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>> Patrick
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> You received this message because you are subscribed to the
>>>>>>>>>>>>> Google Groups "Thinking Sphinx" group.
>>>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>>>>>> send an email to [email protected].
>>>>>>>>>>>>> To post to this group, send email to
>>>>>>>>>>>>> [email protected].
>>>>>>>>>>>>> Visit this group at
>>>>>>>>>>>>> http://groups.google.com/group/thinking-sphinx?hl=en.
>>>>>>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> You received this message because you are subscribed to a topic in
>>>>>>>>>>>> the Google Groups "Thinking Sphinx" group.
>>>>>>>>>>>> To unsubscribe from this topic, visit
>>>>>>>>>>>> https://groups.google.com/d/topic/thinking-sphinx/yiF1CHH9XAA/unsubscribe?hl=en.
>>>>>>>>>>>> To unsubscribe from this group and all its topics, send an email
>>>>>>>>>>>> to [email protected].
>>>>>>>>>>>> To post to this group, send email to
>>>>>>>>>>>> [email protected].
>>>>>>>>>>>> Visit this group at
>>>>>>>>>>>> http://groups.google.com/group/thinking-sphinx?hl=en.
>>>>>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>>>> Groups "Thinking Sphinx" group.
>>>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>>>> send an email to [email protected].
>>>>>>>>>>> To post to this group, send email to
>>>>>>>>>>> [email protected].
>>>>>>>>>>> Visit this group at
>>>>>>>>>>> http://groups.google.com/group/thinking-sphinx?hl=en.
>>>>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> You received this message because you are subscribed to a topic in
>>>>>>>>>> the Google Groups "Thinking Sphinx" group.
>>>>>>>>>> To unsubscribe from this topic, visit
>>>>>>>>>> https://groups.google.com/d/topic/thinking-sphinx/yiF1CHH9XAA/unsubscribe?hl=en.
>>>>>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>>>>>> [email protected].
>>>>>>>>>> To post to this group, send email to
>>>>>>>>>> [email protected].
>>>>>>>>>> Visit this group at
>>>>>>>>>> http://groups.google.com/group/thinking-sphinx?hl=en.
>>>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>>> Groups "Thinking Sphinx" group.
>>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>>> send an email to [email protected].
>>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>>> Visit this group at
>>>>>>>>> http://groups.google.com/group/thinking-sphinx?hl=en.
>>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> You received this message because you are subscribed to a topic in the
>>>>>>>> Google Groups "Thinking Sphinx" group.
>>>>>>>> To unsubscribe from this topic, visit
>>>>>>>> https://groups.google.com/d/topic/thinking-sphinx/yiF1CHH9XAA/unsubscribe.
>>>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>>>> [email protected].
>>>>>>>> To post to this group, send email to [email protected].
>>>>>>>> Visit this group at http://groups.google.com/group/thinking-sphinx.
>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "Thinking Sphinx" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>>>> an email to [email protected].
>>>>>>> To post to this group, send email to [email protected].
>>>>>>> Visit this group at http://groups.google.com/group/thinking-sphinx.
>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to a topic in the
>>>>>> Google Groups "Thinking Sphinx" group.
>>>>>> To unsubscribe from this topic, visit
>>>>>> https://groups.google.com/d/topic/thinking-sphinx/yiF1CHH9XAA/unsubscribe.
>>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>>> [email protected].
>>>>>> To post to this group, send email to [email protected].
>>>>>> Visit this group at http://groups.google.com/group/thinking-sphinx.
>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google Groups
>>>>> "Thinking Sphinx" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send an
>>>>> email to [email protected].
>>>>> To post to this group, send email to [email protected].
>>>>> Visit this group at http://groups.google.com/group/thinking-sphinx.
>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "Thinking Sphinx" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/thinking-sphinx/yiF1CHH9XAA/unsubscribe.
>>>> To unsubscribe from this group and all its topics, send an email to
>>>> [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at http://groups.google.com/group/thinking-sphinx.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Thinking Sphinx" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/thinking-sphinx.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Thinking Sphinx" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/thinking-sphinx/yiF1CHH9XAA/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/thinking-sphinx.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Thinking Sphinx" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/thinking-sphinx.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
--
You received this message because you are subscribed to the Google Groups
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.