patch for retrieving attributes only

1 view
Skip to first unread message

Martin Sarsale

unread,
Dec 15, 2009, 9:01:46 AM12/15/09
to thinkin...@googlegroups.com
Dear All, Pat:

For a specific query we had on our system, we could build the answer
with just the Sphinx index attributes values which we found it's very
fast compared with going to the db server to retrieve the real data.

So we patched TS and added a search's :attributes_only implemented in
a similar way to search's :ids_only.

Pat: are you interested in this patch? it's just a few lines, (we
hope) harmless and I think it adds an interesting capability to TS:

if options[:ids_only]
replace @results[:matches].collect { |match|
match[:attributes]["sphinx_internal_id"]
}
elsif options[:attrs_only]
replace @results[:matches].collect { |match|
match[:attributes]
}

Thanks in advance!

--
Martin Sarsale
msn: mar...@malditainternet.com
jabber: martin....@gtalk.com
twitter: http://twitter.com/runixo
linkedin: http://www.linkedin.com/in/msarsale
sumavisos: http://www.sumavisos.com
blog: http://runa.tumblr.com

Pat Allan

unread,
Dec 25, 2009, 10:48:09 PM12/25/09
to thinkin...@googlegroups.com
Hi Martin

Thanks for the patch - I'd probably shy away from pulling it into TS proper... however, if you wanted to write a patch that just returned the raw Riddle results (:raw => true), and then you have a helper method that pulls the attributes from that in your own code. This would keep it as something a bit more useful to more people.

Still, if others start requesting that they just want attributes, then maybe this is worth pulling in.

Thanks

--
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