yawik / Solr

This YAWIK module enables solr search for job openings.
http://jobs.yawik.org
MIT License
1 stars 2 forks source link

Make Sort order configurable #20

Closed cbleek closed 5 years ago

cbleek commented 5 years ago

Currently, the sort order is hardcoded descending by date.

We want to make this configurable. For example this would make the

< $randString = rand(1,100); < $query->addSortField('random'.$randString, SolrQuery::ORDER_DESC);

TiSiE commented 5 years ago

The configurable sort order should only be applied when an "empty search" is performed. https://github.com/yawik/Solr/blob/90177bc429571e6628676add488da079fa505908/src/Filter/JobBoardPaginationQuery.php#L62-L65

Analogous to #19, there should be an array value in the ModuleOptions to allow specifiying one or more sort orders. The currently harcoded one should stay the default choice, if nothing is configured.

Possible options array could be

[
    'fieldName' => SolrQuery::ORDER_ASC,
    'secondField' => SolrQuery::ORDER_DESC,
];

or an array of arrays

[
    ['fieldName', SolrQuery::ORDER_ASC],
]
TiSiE commented 5 years ago

@kilip It would be great if you could do it.

Please note, that the default branch was changed to 'master'