Hi Pat

No, that's a great help. I thought that you weren't supposed to
use :order and :group_by in the same search so I was racking my brains
trying to figure out how to sort records within a group by a certain
criteria and then sort the groups by another. Chuffed I am.

Another question though, should I always be adding @relevance to the
group_by and :order clauses. I mean, will it have any affect?

Cheers

Shaun

On Jan 28, 7:18 pm, Pat Allan <[email protected]> wrote:
> Hi Shaun
>
> Unfortunately, I don't think Sphinx ranks exact matches within a field any 
> higher than others... but this is a line of questioning it might be worth 
> pursuing on the Sphinx forums instead.
>
> Also, field weightings may only be applied for extended matching (which is 
> automatic if you use :conditions, but otherwise needs to be explicitly 
> requested - :match_mode => :extended). That said, last time I went to confirm 
> this in the docs, I couldn't spot it, so maybe it's something I got wrong a 
> long time ago.
>
> As for grouping - it seems like you've been reading up on this a fair bit 
> already, but just in case you didn't know and it's helpful:
>   :group_clause is for sorting the groups
>   :order is for sorting within each group
>
> Sorry I'm not much help.
>
> --
> Pat
>
> On 27/01/2010, at 1:30 PM, Shaun wrote:
>
>
>
> > I've been looking into this even more.
>
> > The weighting option seems to get left out. The more I try with
> > different options the more it seems they're not having an affect.
>
> > If I do a basic search:
>
> > Product.search(:conditions => {:title => "keyword"}) on an index that
> > I know has multiple records that have an exact match and a few that
> > have the keyword within the text I get a result set that orders the
> > records by ID.
>
> > This means that when I do this search:
> > Product.search(:conditions => {:title => "pancake"})
>
> > I get something like:
>
> > Title: Pancake
> > Location: Brisbane
>
> > Title: How to make a pancake
> > Location: Sydney
>
> > Title: Pancake
> > Location: Somewhere else
>
> > but surely the two records who's title is an exact match should come
> > first?
>
> > If I look in the development log I can see that the products are being
> > fetched by ID wit their ids in chronological order. This is then how
> > they are displayed in my result set. Shouldn't the ids being fetched
> > be ordered by relevance?
>
> > Am I correct of have I misunderstood?
>
> > Thanks
>
> > Shaun
>
> > On Jan 27, 8:37 am, Shaun <[email protected]> wrote:
> >> Hi
>
> >> I have a bit more information. It seems that the field_weights do work
> >> but what is happening is that relevancy is being sacrificed for the
> >> contents of :group_clause.
>
> >> So, ignoring field_weights for a second, I'm wondering should I be
> >> adding "@relevancy DESC" to the beginning of my group_clause or should
> >> I add :order onto the end of the search query,into which I would put
> >> "@relevancy DESC". In which case, which comes first, :group_clause
> >> or :order?
>
> >> Any suggestions would be appreciated.
>
> >> Shaun
>
> >> On Jan 26, 5:09 pm, Shaun <[email protected]> wrote:
>
> >>> Hello
>
> >>> I have managed to group my records by a certain attribute.
>
> >>> I am now trying to get weighting to work. The index contains two
> >>> fields, one of which I have weighting set higher:
>
> >>> :field_weights = {:title => 100}
>
> >>> The other field I have left, believing it to default to zero and so be
> >>> at the bottom of the pack.
>
> >>> Thing is, if I search for a term that I know exists exactly as is in
> >>> the weighted field, the first document returned is one that contains
> >>> the search term within the text of the non-weighted field.
>
> >>> My question is, would setting group_by and group_clause affect the
> >>> influence of the weighting? If for example, my group_clause was
> >>> causing the said document to display first, regardless of the field
> >>> weight, how can I make field_weight have more affect than my
> >>> group_clause option?
>
> >>> Hope that makes sense?!
>
> >>> Thanks
>
> >>> Shaun
>
> > --
> > 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