简体   繁体   English

将限制应用于Grails可搜索结果

[英]Applying restrictions to Grails Searchable results

I'm developing an application with Grails 2.2.2 / MySQL. 我正在使用Grails 2.2.2 / MySQL开发应用程序。

I'd like to integrate the Searchable plugin, however my application is a multi-tenant saas app, and I need to restrict the results that are returned somehow. 我想集成Searchable插件,但是我的应用程序是一个多租户saas应用程序,我需要限制以某种方式返回的结果。 So for instance if I am a user of my application belonging to organisation A and I search for products, I should not see any products that belong to organisation B. 因此,例如,如果我是属于组织A的应用程序的用户,并且我搜索产品,则不应看到属于组织B的任何产品。

I currently have a service that carries out this kind of data partitioning when using the regular grails CRUD pages which works by applying restrictions to every criteria query executed. 我目前有一个服务,可以在使用常规grails CRUD页面时执行这种数据分区,该页面通过对执行的每个条件查询施加限制来起作用。 I've also integrated this service with the Filterpane plugin, for 'advanced search' style queries. 我还将此服务与Filterpane插件集成在一起,用于“高级搜索”样式查询。

Is it possible to filter Searchable results in a similar way? 是否可以以类似方式过滤可搜索结果?

It's been a while since I looked into this, but I did come across an interesting article about partitioning a lucene index so that 1) there is one index for the application and 2) search results for organisation A are not biased in any way by the stuff that has been indexed for organisation B (I didn't even consider that second point). 自从我研究这个问题已经有一段时间了,但是我确实碰到了一篇有趣的文章,关于对Lucene索引进行分区,因此1)应用程序有一个索引,并且2)组织A的搜索结果没有任何偏向。已经为组织B编制索引的内容(我什至没有考虑第二点)。

https://community.jivesoftware.com/community/developer/blog/2013/06/24/a-new-experimental-approach-to-implement-multi-tenancy-with-lucene-4 https://community.jivesoftware.com/community/developer/blog/2013/06/24/a-new-experimental-approach-to-implement-multi-tenancy-with-lucene-4

Also, for my application, I've sort of met the 'full text searching' requirement (for the short term at least) by using the excellent Quick Search plugin for grails. 此外,对于我的申请,我已经有点用出色的满足“全文搜索”的要求(在短期内至少) 快速搜索插件 Grails的。

Hopefully someone will find these resources useful. 希望有人会发现这些资源有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM