Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix slice and counts, and add modifiers #13

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

nicolasfranck
Copy link
Contributor

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.

@nicolasfranck
Copy link
Contributor Author

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?

@nicolasfranck
Copy link
Contributor Author

nicolasfranck commented Aug 4, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant