The problem is that if I use this it ignores my limit clause.
I set limit on 10 and I still get 5995 results and it takes several
seconds.
How come the limit clause is ignored when using a filter_proc? How
can I change this behaviour?
Filters are applied by Ferret before the result is limited, that’s why
your filter gets to see all possible results regardless of the limit
you specify. If it was implemented the other way around, first
limiting and then filtering, you would possibly end up with less than
limit results in case your filter would actually filter out any
results. Of course in your case this wouldnt happen as your filter
does no filtering but always returns true.
If you really only want the first 10 results, why dont you just use
the results you get back and do your result
collecting there like this?
You could of course also return false in your filter_proc for every
possible hit once your results collection has reached the desired size
to save the time collecting all results.