etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.21k stars 129 forks source link

Per user or profile results #253

Closed n3storm closed 5 years ago

n3storm commented 5 years ago

I need to index and search a lot of documents. Documents are used by different organizations than can only access a subset of the whole lot.

Access is determined by groups in a tree like structure. Tree is finite.

Is it crazy or dumb or impossible the following?:

Create a proxy model per tree node to filter documents accordingly to access permission and register to django-watson those proxy models.

Thanks in advance and any other approach that doesnt't include "filtering on view" will be welcomed.

etianen commented 5 years ago

Creating a proxy model per tree node sounds pretty crazy, IMO.

I would almost certainly advocate filtering the search result queryset on view to apply the permissions there.

On Wed, 19 Dec 2018 at 12:50, Néstor Díaz Valencia notifications@github.com wrote:

I need to index and search a lot of documents. Documents are used by different organizations than can only access a subset of the whole lot.

Access is determined by groups in a tree like structure. Tree is finite.

Is it crazy or dumb or impossible the following?:

Create a proxy model per tree node to filter documents accordingly to access permission and register to django-watson those proxy models.

Thanks in advance and any other approach that doesnt't include "filtering on view" will be welcomed.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/253, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCF6QXSIpG_DxOwDbNvSqpCPK7ed1ks5u6jYXgaJpZM4ZaLol .

n3storm commented 5 years ago

There where less than 120 proxies (done programatically of course).

You are probably are right but I found this solution for Django Haystak: https://stackoverflow.com/questions/28561054/django-haystack-create-multiple-indexes-for-the-same-model

How about to make 17 proxies? only for one level and second level fathers? and then filter from there on the view. That will filter out a lot and queries will be much smaller. Those 17 will not grow ever. Their children will grow with time (slowly).

etianen commented 5 years ago

I mean... maybe it would work...

But I don't see what's wrong with filtering on view. That just seems less hacky to me.

On Thu, 20 Dec 2018 at 14:34, Néstor Díaz Valencia notifications@github.com wrote:

There where less than 120 proxies (done programatically of course).

You are probably are right but I found this solution for Django Haystak:

https://stackoverflow.com/questions/28561054/django-haystack-create-multiple-indexes-for-the-same-model

How about to make 17 proxies? only for one level and second level fathers? and then filter from there on the view. That will filter out a lot and queries will be much smaller. Those 17 will not grow ever. Their children will grow with time (slowly).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/253#issuecomment-449018613, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCKN8eUhBaR1gudRzld01C_TxnHH7ks5u65_2gaJpZM4ZaLol .

n3storm commented 5 years ago

I realized there are roughly 18000 entries and would not duplicate within the next 5 years.

I will follow your advice @etianen, thank you very much :) and thank you for the KISS reminder ;)

etianen commented 5 years ago

Good luck! :P

On Thu, 20 Dec 2018 at 16:22, Néstor Díaz Valencia notifications@github.com wrote:

I realized there are roughly 18000 entries and would not duplicate within the next 5 years.

I will follow your advice @etianen https://github.com/etianen, thank you very much :) and thank you for the KISS reminder ;)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/etianen/django-watson/issues/253#issuecomment-449053794, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJFCBJitxXmo7OggE0j8sTK96N08dTDks5u67k8gaJpZM4ZaLol .