简体   繁体   中英

Applying restrictions to Grails Searchable results

I'm developing an application with 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. 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.

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. I've also integrated this service with the Filterpane plugin, for 'advanced search' style queries.

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

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.

Hopefully someone will find these resources useful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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