Finding submodules with Ferret

I have a rails app where I am trying to do a full text search. FerrΓ© seems to be the most popular choice. However, I have a problem.

I have a "thing" that contains an id that determines if the user can see it (and therefore search for it), but I want to search for sub-models of that "thing" that are related to my "thing" but do not directly contain links to the user.

So how should I implement it? Is there a sane way to implement this, or do I need to pollute my models with a domain id link?

0


a source to share


1 answer


I think it would be very wrong to assume that Ferret is the most popular choice for this. Most people I know dumped Ferret and replaced him with the Sphinx. And people who for some reason cannot use the Sphinx chose Xapian.

That said, the answer to your question is likely to be largely the same regardless of the indexing system you choose:

When you are dealing with permissions and indexing, you cannot effectively index anything related to the permissions system because it will be user specific. All of your permission stuff must live in your models / controllers somewhere. I am passionate about placing all my permission stuff in a module and then including it in my model so I can easily share it between models.



Markup can be a real pain for this kind of thing because you are requesting 10 items from your search engine and then your permission code rejects 5 of those items, which means you have to keep searching until you have your first ten items to display. And now that you need a second page, well, then things become a real mess. Heaven forbids them from going straight to page ten because now you can't do tricks like giving a start ID instead of a page number. In fact, this is not something you want to do at all if you can help him.

There is really no smart way to get around the mismatch between permissions and full-text indexing. At least I don't know anything. It's just pain.

I suggested to my boss when we first started that the only sane solution is an evalerial permission system: if we give you a username and password, then you have access. He was not a fan.

+1


a source







All Articles