Why is the rows field only capable of values 5, 10, 15, 20, 25, 30, 40, 50, 60, 70, 80, 90, 100?
example: I want it to be 9, how do I do this?
I suggest the following change to the form declaration:
$form['apachesolr_rows'] = array(
'#type' => 'textfield',
'#title' => t('Results per page'),
'#default_value' => variable_get('apachesolr_rows', 10),
'#description' => t('The number of results that will be shown per page.'),
);
And I suggest the following addition to the validation of the form:
function apachesolr_settings_validate($form, &$form_state) {
/*
... old validations
*/
if (isset($form['apachesolr_rows'])) {
$rows = $form_state['values']['apachesolr_rows'];
// TODO: Port range should be 0-65535, but 0 crashes apachesolr
if (!is_numeric($rows)) {
form_set_error('apachesolr_rows', t('The amount of result rows should be numeric.'));
}
}
}Could this not be usefull?
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 993476-set-rows-11-7.x.patch | 1.73 KB | pwolanin |
| #10 | 993476-set-rows-10.patch | 2.23 KB | pwolanin |
| #6 | 993476-set-rows-6.patch | 1.65 KB | pwolanin |
| #2 | 993476.patch | 1.3 KB | jpmckinney |
Comments
Comment #1
janusman commentedBefore you can mark an issue as "Needs review", you need to roll a patch and attach it to one of your comments.
Functionality-wise, I don't see why not. This is how Views does it.
Putting into "active" status.
Comment #2
jpmckinney commentedNot sure why we offer a select list. Pretty safe to let people set their own values.
Comment #3
jpmckinney commentedMarked #886938: is there a hook to override the paging of search results? duplicate.
Comment #4
janusman commentedProbably we only want numbers above 0 =)
Powered by Dreditor.
Comment #5
jpmckinney commentedI don't know, if someone sets it to zero, I assume they know what they are doing. 0 rows still gets facet data, total matches, etc. I can imagine some less common uses for 0 results. I don't think we need to hold the admin's hand too much.
Comment #6
pwolanin commentedWell, we should probably cast it to an int and make sure it's at least 0?
Also, in the real world, I've noticed pretty serious performance effects from returning lots of results, so I think we may want an upper bound like ~200 to avoid having people shoot themselves in the foot?
Comment #7
jpmckinney commentedI'm not a fan of hand-holding - it's the same reason we had a dropdown instead of a textfield. Anyway, patch looks good.
Comment #8
wouters_f commentedI have tested this - big success (borat smile).
thanks guys.
Comment #9
pwolanin commentedoops - that patch causes a fatal error by re-declaring the validate function. Committed that plus fix.
@wouters_frederik which one did you test?
Comment #10
pwolanin commentedThis is what I committed to 6.x-1.x and 6.x-2.x (except for CHANGELOG piece which was different)
Comment #11
pwolanin commented7.x patch
Comment #12
pwolanin commentedcommitted
Comment #13
broncomania commentedIsn't it much better that the user choose how many search results he want to see? I think even the best admin didn't find the best value even if it's 9 or 27 results?
I just research a little bit but I didn't found any solutions yet. So maybe this is also one thing we should think about.
Comment #15
phenaproximaFor the record, I agree with broncomania - I'd like to see this functionality implemented in a user-facing way too. Can this bug be reopened?