Concat / Merge data into one search field

130 views
Skip to first unread message

Tom Davies

unread,
Aug 26, 2009, 2:54:47 PM8/26/09
to Thinking Sphinx
A quick search didn't turn up an answer so I am hoping someone knows
if this is possible with Sphinx / Thinking Sphinx. I would like to
merge data from many fields into one search field. I know SOLR /
Lucene supports this just not sure how to do it in Sphinx.

For an example, say I have an item with a description and many tags.
I would like to concatenate both the description and tags into the
same field in Sphinx so I can give them equal weight w/out skewing
results in favor of items that have both a description and tag
match.

Is this possible?

Thanks,
Tom

Pat Allan

unread,
Aug 26, 2009, 5:09:52 PM8/26/09
to thinkin...@googlegroups.com
It is indeed possible - something along the lines of the following
should do the trick (as many column references as you like, in an
array).

indexes [description, tags(:name)], :as => :description_and_tags

--
Pat

Tom Davies

unread,
Aug 26, 2009, 10:12:35 PM8/26/09
to Thinking Sphinx
Thanks Pat. I was hoping it would be that easy and with Thinking
Sphinx it usually is. Not sure how I missed that :)

Tom
Reply all
Reply to author
Forward
0 new messages