Optimal way to restrict search results

Hello,

I am curious how one could efficiently filter results in a social network
using ElasticSearch. Let's say that a user wants to search for a phrase,
but only among documents authored by his friends. The user may have tens of
thousands (or more) friends which can change fairly often.

Using an OR Filter should work, but could result in huge JSON requests. A
FilterBuilder could be used instead, but does not seem very reusable. I was
not able to find the best Lucene solution, as it is not clear to me whether
a custom filter, multi phrase query, or other is best.

Any suggestions appreciated.

--
Adam
zellster@gmail.com

if the friends field is not analyzed (maybe by id?), then you can use the
terms filter, and add a term per friend. Still be long, but not as long and
more efficient then other solutions.

-shay.banon

On Thu, Aug 19, 2010 at 10:18 AM, Adam Zell zellster@gmail.com wrote:

Hello,

I am curious how one could efficiently filter results in a social network
using Elasticsearch. Let's say that a user wants to search for a phrase,
but only among documents authored by his friends. The user may have tens of
thousands (or more) friends which can change fairly often.

Using an OR Filter should work, but could result in huge JSON requests. A
FilterBuilder could be used instead, but does not seem very reusable. I was
not able to find the best Lucene solution, as it is not clear to me whether
a custom filter, multi phrase query, or other is best.

Any suggestions appreciated.

--
Adam
zellster@gmail.com