Ok, managed to sort it out by using the search query field and
indexing those attributes.

Here is the basic solution:
"#{params[:search]} & ((@search_access_tag
#{(@search_access_tags).collect {|t| t.to_s}.join(' | ')}) |
(@geoblock_disabled_for...@country_code} 1 & @search_access_tag
#{(@anon_search_access_tags << 0).collect {|t| t.to_s}.join(' | ')}))"

Best regards,
Robert

On Oct 9, 7:34 pm, rbjarnason <[email protected]> wrote:
> Sorry that should be:;
> :with=>{search_access_tag=>access_tags_from_first_user}
>   OR
> :with=>{search_access_tag=>access_tags_from_anon_user,
>            "geoblock_disabled_for...@country_code.downcase}"=>true}
>
> On Oct 9, 7:28 pm, rbjarnason <[email protected]> wrote:
>
>
>
>
>
>
>
> > Actually when testing this I realize I have misunderstood the behavior
> > of bundle_search.
>
> > I was hoping to be able to run two queries and get one set of results
> > back with the combined hits.
>
> > I need to be able to do a search with filters like those:
> > :with=>{search_access_tag=>access_tags_from_first_user}
> >   AND
> > :with=>{search_access_tag=>access_tags_from_anon_user,
> >            "geoblock_disabled_for...@country_code.downcase}"=>true}
>
> > So in the first case I get an array of access tags from the logged in
> > user and in the second case I get an array of access tags from an
> > anonymous user if the geo_blocking is disabled for that document for a
> > given country.
>
> > Any ideas how I could implement this in a single query? Or if I can
> > somehow merge the result sets from two queries while still making
> > pagination and facets work.
>
> > Best regards,
> > Robert
>
> > On Oct 9, 1:09 am, rbjarnason <[email protected]> wrote:
>
> > > I guess I could call facets twice with the two different bundle_search
> > > queries and then "merge" the results in a way I would add missing
> > > facet results from the first search from the second search.  This
> > > would create almost the correct behavior except that counts would be
> > > wrong in some cases...  Then instead of using facet.for I would just
> > > add the facet drill-down parameter to the main search hash.  I know
> > > its a bit of a hack but if I could find a way to get the counts rights
> > > for the two facet calls at least it would work.
>
> > > Will look into this more but if anybody has a better idea to solve
> > > this quickly let me know.
>
> > > Best regards,
> > > Robert
>
> > > On Oct 8, 6:41 pm, rbjarnason <[email protected]> wrote:
>
> > > > Hi,
>
> > > > Doesn't look that .facets work with bundle_searches and I understand
> > > > that this was created internally for facets.  I do however need this
> > > > feature to enable some quite complex access control logic which will
> > > > be easy to implement if I can run two searches with different
> > > > parameters on the same fields.
>
> > > > I'm using the latest plugin install version.  Just to be sure, should
> > > > facets work with bundles searches? Are there any plans to enable
> > > > facets with bundles_searches? If not I will take a stab at making it
> > > > work and any pointers to help me with the implementation would be
> > > > appreciated.
>
> > > > Best regards,
> > > > Robert

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

Reply via email to