Open nicolasfranck opened 7 years ago
Remark: the combination of a slice and select can be tricky
a select->slice is not the same as slice->select.
Consider this array: 0,1,2,3,4,5,6,7,8,9
slice(2,2)->slice(1)->select( odd => 1 )
[2,3] => [3] => [3]
select( odd => 1 )->slice(2,2)->slice(1)
[1,3,5,7,9] => [5,7] => [7]
This is in fact what would happen if the Solr package did not implements these methods, and the default slice and select would happen (using the generator).
I had a look at how Rails does this, and it's not different there:
Model.limit(2).offset(1).where( "foo" => "bar)
creates the same query as
Model.where( "foo" => "bar).limit(2).offset(1)
Not what todo in such situations. In normal cases select->slice is used?
What should work already:
slice->slice ..
select->select
select->slice
This..
slice->select
should be fixed by adding an extra check in the "around select" modifier: only if start is 0 and total not provided (read: no slice), should one generate a new Searcher-object . See latest commit.
when computing the appropriate start en limit values for solr, when doing a slice, one should remain within the boundaries of a previous slice; the same for count.