Extended search mode for specific columns

16 views
Skip to first unread message

Lephyrius

unread,
Oct 2, 2012, 3:09:57 AM10/2/12
to Thinking Sphinx
I want to search for users by only their username and not the
presentation.
So I added a index:
define_index do
indexes username
indexes presentation
set_property field_weights: { username: 7, presentation: 1 }
if Rails.env.production?
set_property delta: FlyingSphinx::DelayedDelta
end
end

And then searched using this method call:

User.search("@username \"#{params[:term]}\"~3", match_mode: :extended)

I have these users in the DB: Roco, Loco and Coco.
When I search for:
Sphinx Query (2.6ms) @username "oco"~3
Sphinx Found 0 results

I was expecting: Roco, Loco and Coco but I got 0 results instead.
What am I doing wrong?
Do I need to filter the search term before I insert it to sphinx
query? Any function for it?

Pat Allan

unread,
Oct 3, 2012, 9:33:23 AM10/3/12
to thinkin...@googlegroups.com
You'll need to add in the wildcard stars yourself:

@username "*oco*"~3

I'm presuming you've got the enable_star and min_infix_len settings set? See halfway down this page:
http://pat.github.com/ts/en/advanced_config.html

--
Pat

> --
> You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group.
> To post to this group, send email to thinkin...@googlegroups.com.
> To unsubscribe from this group, send email to thinking-sphi...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en.
>


Reply all
Reply to author
Forward
0 new messages