Ah, well, Sphinx has pagination built-in - indeed, you can't turn it off. So 
this is why you get 20 results unless requesting otherwise. :max_matches is the 
total number of results that Sphinx pulls together, but :limit (or :per_page, 
matching will_paginate's expectations) is the default page size.

Also: if you're setting :max_matches higher overall in your sphinx.yml file, 
you will also need to set it on a per-query basis.

Hopefully this clarifies things :)

-- 
Pat

On 23/10/2010, at 7:24 AM, Robert Sturim wrote:

> Interesting...
> 
> If I type:
> 
> TopicComment.search('version', :limit => 1000).size 
> or 
> TopicComment.search('version', :limit => 1000).total_entries
> 
> I get 424 results.
> 
> If I leave off the limit, I get 20.
> 
> I think that is the difference in what I'm finding and what I am expecting. 
> 
> Here is my sphinx.yml config file:
> 
> production:
>   enable_star: 1
>   min_infix_len: 1
>   max_matches: 5000
>   morphology: stem_en
>   html_strip: 1
> 
> 
> If my max_matches is 5000, why are my search results defaulting to a limit of 
> 20?
> 
> Thanks again for your help.
> 
> Bob
> 
> On Wed, Oct 20, 2010 at 4:34 AM, Pat Allan <[email protected]> wrote:
> Hi Bob
> 
> Just want to double-check something - can you run the following queries in 
> script/console:
> 
>  TopicComment.search_for_ids('version', :limit => 1000).total_entries
>  TopicComment.search_for_ids('version', :limit => 1000).sort
> 
> Or better yet, add .include?(id_of_topic_comment_you_are_expecting) to the 
> end of the second one... just want to make sure Sphinx's pagination isn't 
> getting in the way.
> 
> Cheers
> 
> --
> Pat
> 
> On 20/10/2010, at 10:13 AM, Robert Sturim wrote:
> 
> > Hi Pat...
> >
> > The largest id is not large...under 10,000.
> >
> > Thanks.
> >
> > Bob
> >
> > Sent from my iPhone
> >
> > On Oct 19, 2010, at 6:53 PM, Pat Allan <[email protected]> wrote:
> >
> >> Hi Bob
> >>
> >> What are the ids you're expecting to see? What I'm getting at is: how big 
> >> are they? Beyond an unsigned 32bit integer?
> >>
> >> Unlikely for most setups, but I just want to double-check.
> >>
> >> --
> >> Pat
> >>
> >> On 20/10/2010, at 3:40 AM, Robert Sturim wrote:
> >>
> >>> Hi Pat,
> >>>
> >>> Not sure if I understand your comment regarding putting asterisks around 
> >>> a one word search term versus enable_star, but it doesn't sound like I 
> >>> need to for now...
> >>>
> >>> There really isn't another text field on that particular entity. However, 
> >>> I did try putting in a different search term:
> >>>
> >>> TopicComment.search('Connection to CFront Failed')
> >>>
> >>> and it did find the result I was looking for.
> >>>
> >>> One other strangeness about attempting to search on "version". It looks 
> >>> like the matches it does find are all entities with rather low id #'s. 
> >>> For example,
> >>>
> >>>>> TopicComment.count
> >>> => 4199
> >>>
> >>>>> TopicComment.search('version').collect(&:id).sort
> >>> => [76, 99, 100, 104, 114, 117, 126, 127, 128, 129, 130, 140, 148, 149, 
> >>> 163, 171, 175, 183, 187, 189]
> >>>
> >>> That seems suspicious. I can definitely confirm that there are instances 
> >>> of "version" that are more or less randomly distributed throughout the 
> >>> range of id's. And if I specify the longer search term which I did 
> >>> confirm returns the result I am looking for, I get:
> >>>
> >>>>> TopicComment.search('Connection to CFront Failed').collect(&:id).sort
> >>> => [117, 126, 127, 128, 129, 1891, 2379, 2436, 3009, 3621, 4361, 4401]
> >>>
> >>> (the record I am looking for has an idea of #2436)
> >>>
> >>> I'm not sure if that is a clue or not.
> >>>
> >>> Thanks again.
> >>>
> >>> Bob
> >>>
> >>>
> >>> On Fri, Oct 15, 2010 at 12:00 AM, Pat Allan <[email protected]> 
> >>> wrote:
> >>> ere an
> >>>
> >>>
> >>> --
> >>> 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.
> >>
> >
> > --
> > 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.
> 
> 
> 
> -- 
> 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