Hey Pat-
Thanks so much for the help. Unfortunately I haven't gotten the expected
results with this scenario. It still only returns "apple" when run without
{star: true} and returns the infix matches first when run with {star: true}.
Here is a gist of my setup and what the sphinx query log says when I run the
query: https://gist.github.com/jerodsanto/5042633
I stopped TS, removed all indexes, reconfigured, indexed again, and started TS.
Same results. :(
Thanks again!
-Jerod
On Friday, February 22, 2013 at 10:13 PM, Pat Allan wrote:
> Hi Jerod
>
> What you've read is right - you need two indices defined, and you can put
> them in the same file:
>
> ThinkingSphinx::Index.define :topic, with: :active_record, name:
> 'straight_topics' do
> indexes :name, sortable: true
> end
>
> ThinkingSphinx::Index.define :topic, with: :active_record, name:
> 'infixed_topics' do
> indexes :name, sortable: true
>
> set_property enable_star: true, min_infix_len: 2
> end
>
> And then with searching:
>
> Topic.search 'apple', index_weights: {'straight_topics_core' => 3,
> 'infixed_topics_core' => 1}
>
> This will mean you can't have enable_star or min_infix_len set globally in
> config/thinking_sphinx.yml though, as it shouldn't apply to every index.
>
> Give this a shot, let us know how you go.
>
> Cheers
>
> --
> Pat
>
> On 22/02/2013, at 9:16 AM, sant0sk1 wrote:
>
> > Hello-
> >
> > I'm on ThinkingSphinx 3.0.1 and Sphinx 2.0.5.
> >
> > I am trying to find a way to perform infix searches with exact matches
> > coming first. My index is simple:
> >
> > ThinkingSphinx::Index.define :topic, with: :active_record do
> > indexes :name, sortable: true
> > end
> >
> > For example, when I perform:
> >
> > Topic.search("apple", enable_star: true)
> >
> > It currently returns:
> >
> > appleton
> > applevalleycalifornia
> > applevalleyminnesota
> > apple
> > applebees
> >
> > I'd like "apple" to come first followed by whatever infix matches are most
> > relevant, but everything I try returns results before "apple" unless I
> > disable infix matching altogether.
> >
> > Is this possible? I've read that I may have to create two indexes and have
> > one of them weighted over the other, but I'm not sure how to go about this
> > with the new index definition syntax.
> >
> > Any help would be much appreciated!
> >
> > -Jerod
> >
> > --
> > 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]
> > (mailto:[email protected]).
> > To post to this group, send email to [email protected]
> > (mailto:[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]
> (mailto:[email protected]).
> To post to this group, send email to [email protected]
> (mailto:[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.