Adapt code to new Solr config
This commit is contained in:
@@ -533,7 +533,7 @@ class NetBiblio extends WebService
|
||||
* @param string $query Text to search
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @return array
|
||||
* @return array an array of books
|
||||
* @throws WebException
|
||||
*/
|
||||
public function Search($query, $start, $limit)
|
||||
@@ -574,6 +574,16 @@ class NetBiblio extends WebService
|
||||
* ° category : synonym for 'genre' (see above)
|
||||
* ° producer : synonym for 'producerCode' (see above)
|
||||
*
|
||||
* Return value :
|
||||
*
|
||||
* The return value start with two keys :
|
||||
*
|
||||
* ° 'count' : which is the total number of available results
|
||||
* ° 'facets' : which contains all other relevent information (facets, spellchecking,
|
||||
* highlighting, etc). This name is used for compatibility reasons.
|
||||
*
|
||||
* Then, the books come right after.
|
||||
*
|
||||
* @param string $values JSON encoded object
|
||||
* @return array
|
||||
* @throws WebException
|
||||
@@ -601,17 +611,6 @@ class NetBiblio extends WebService
|
||||
|
||||
$bs = new BookSearch();
|
||||
|
||||
if (isset($queryArray['queryType'])) {
|
||||
$bs->addSortField('author', \SolrQuery::ORDER_ASC);
|
||||
$bs->addSortField('title', \SolrQuery::ORDER_ASC);
|
||||
$bs->addSortField('producerCode');
|
||||
$bs->addSortField('mediaType', \SolrQuery::ORDER_ASC);
|
||||
} else {
|
||||
$bs->addSortField('availabilityDate');
|
||||
$bs->addSortField('author', \SolrQuery::ORDER_ASC);
|
||||
$bs->addSortField('title', \SolrQuery::ORDER_ASC);
|
||||
}
|
||||
|
||||
if (isset($queryArray['queryText']) && strlen($queryArray['queryText']) > 0) {
|
||||
$type = isset($queryArray['queryType']) ? $queryArray['queryType'] : null;
|
||||
|
||||
@@ -729,8 +728,13 @@ class NetBiblio extends WebService
|
||||
} else {
|
||||
$s->addQuery($genre, 'genre');
|
||||
}
|
||||
// this is not strictly speaking needed since we boost
|
||||
// more recent books anyway, but let be on the safe side
|
||||
$s->addSortField('availabilityDate');
|
||||
|
||||
// we only want visible books
|
||||
$s->addQuery(1, 'visible');
|
||||
|
||||
$results = $s->getResults(0, $number);
|
||||
$books = $this->AddBookData($results['books']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user