Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

Honor the search:options page-length (configured in all.xml for example) #19

Open
bobstarbird opened this issue May 16, 2019 · 3 comments
Assignees

Comments

@bobstarbird
Copy link

search:options page-length 10 behaves as if it is hard-coded in js. Changing search options file all.xml has no effect. I could not find where to change the value in the js source. Documenting how to change it would be helpful.

@danielholgate
Copy link
Collaborator

For Vue apps you need to modify the pageLength property (in typedSearchState function) in ui/src/store.js to modify page length. Not sure for React

@patrickmcelwee
Copy link

patrickmcelwee commented May 20, 2019

This is a helpful ticket, because this is likely to be fairly common, and the current implementation breaks expectations.

The named search options stored in MarkLogic are unable to set page length because of several points at which eager code will default it to 10:

  1. the front-end usually sets it.
    a. In the React stack, grove-search-redux defaults the pageLength property of the stagedSearch to 10. In fact, the grove-search-redux library currently lacks an action to change the page length. ... ... I have overridden this in at least one project by circumventing the pageLength property of the stagedSearch, and directly changing the pageLength. See, eg, https://project.marklogic.com/repo/projects/INT/repos/rpaas/browse/rpaas-ui/ui/src/containers/EntitySearchContainer.js#68 ... but that is fairly invasive.
    b. In the Vue stack, as @danielholgate mentioned, it can be reset in ui/src/store.js: https://github.com/marklogic-community/grove-vue-ui/blob/9af54252f8544afc89ff9b18e2043f85f9c63a86/src/store.js#L137

  2. if the front-end does not set it, the middle-tier will set it to 10.

I think we should:

  1. Stop providing a default page-length in grove-search-redux. Create the missing action to update the pageLength if desired. Document how to use it.
  2. Comment out the pageLength in /ui/src/store.js in grove-vue-ui, but document how to add it back if desired by the developer.
  3. Stop defaulting page-length in the middle-tier (MarkLogic already defaults to 10).

@patrickmcelwee patrickmcelwee self-assigned this May 20, 2019
@grtjn
Copy link
Contributor

grtjn commented May 21, 2019

I think you had to override it in the frontend in slush-ml-node as well, rather than in the search options. That said, it should be possible to rely more on backend to provide a default page length, as long as it would still be possible to override it from front-end, in case a user specifies page length from the ui (for instance using a page length drop down or such)..

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

No branches or pull requests

4 participants