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 at
http://groups.google.com/group/thinking-sphinx?hl=en.