Adapt to new Solr config :
- category -> genre - cover in solr - producer -> producerCode
This commit is contained in:
@@ -184,9 +184,9 @@ class AudioBook extends DbMapping
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the list of all categories
|
* Retrieve the list of all genres
|
||||||
*/
|
*/
|
||||||
public static function listOfCategories()
|
public static function ListOfGenres()
|
||||||
{
|
{
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
LTRIM(RTRIM(Code)) as code,
|
LTRIM(RTRIM(Code)) as code,
|
||||||
|
|||||||
@@ -25,12 +25,7 @@ class BookSearch
|
|||||||
$this->query = new SolrQuery();
|
$this->query = new SolrQuery();
|
||||||
$this->query->setQuery('*:*');
|
$this->query->setQuery('*:*');
|
||||||
|
|
||||||
$this->query->addField('id');
|
$this->query->addField('*');
|
||||||
$this->query->addField('title');
|
|
||||||
$this->query->addField('author');
|
|
||||||
$this->query->addField('code');
|
|
||||||
$this->query->addField('category');
|
|
||||||
$this->query->addField('summary');
|
|
||||||
|
|
||||||
$this->query->addParam('q.op', 'AND');
|
$this->query->addParam('q.op', 'AND');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ class NetBiblio extends WebService
|
|||||||
if (isset($queryArray['queryType'])) {
|
if (isset($queryArray['queryType'])) {
|
||||||
$bs->addSortField('author', SolrQuery::ORDER_ASC);
|
$bs->addSortField('author', SolrQuery::ORDER_ASC);
|
||||||
$bs->addSortField('title', SolrQuery::ORDER_ASC);
|
$bs->addSortField('title', SolrQuery::ORDER_ASC);
|
||||||
$bs->addSortField('producer');
|
$bs->addSortField('producerCode');
|
||||||
$bs->addSortField('mediaType', SolrQuery::ORDER_ASC);
|
$bs->addSortField('mediaType', SolrQuery::ORDER_ASC);
|
||||||
} else {
|
} else {
|
||||||
$bs->addSortField('availabilityDate');
|
$bs->addSortField('availabilityDate');
|
||||||
@@ -323,15 +323,15 @@ class NetBiblio extends WebService
|
|||||||
$bs->addQuery($queryArray['queryText'], $type);
|
$bs->addQuery($queryArray['queryText'], $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($queryArray['category']) && is_array($queryArray['category'])) {
|
if(isset($queryArray['genre']) && is_array($queryArray['genre'])) {
|
||||||
$selectedCategories = array_filter($queryArray['category'], function ($c) {
|
$selectedGenres = array_filter($queryArray['genre'], function ($c) {
|
||||||
return $c != '0';
|
return $c != '0';
|
||||||
});
|
});
|
||||||
if (count($selectedCategories) > 0) {
|
if (count($selectedGenres) > 0) {
|
||||||
$selectedCategories = array_map(function ($c) {
|
$selectedGenres = array_map(function ($c) {
|
||||||
return 'categoryCode:'.SolrUtils::escapeQueryChars($c);
|
return 'genreCode:'.SolrUtils::escapeQueryChars($c);
|
||||||
}, $selectedCategories);
|
}, $selectedGenres);
|
||||||
$bs->addQuery('('.implode(' OR ', $selectedCategories).')', null, false);
|
$bs->addQuery('('.implode(' OR ', $selectedGenres).')', null, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -354,10 +354,7 @@ class NetBiblio extends WebService
|
|||||||
);
|
);
|
||||||
|
|
||||||
foreach ($results['response']['docs'] as $doc) {
|
foreach ($results['response']['docs'] as $doc) {
|
||||||
$book = AudioBook::findBy('NoticeID', $doc['id'], true);
|
$data[] = $this->AddFiles($doc);
|
||||||
if($book) {
|
|
||||||
$data[] = $this->AddFiles($book);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
@@ -368,9 +365,9 @@ class NetBiblio extends WebService
|
|||||||
return AudioBook::listOfReaders();
|
return AudioBook::listOfReaders();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ListOfCategories()
|
public function ListOfGenres()
|
||||||
{
|
{
|
||||||
return AudioBook::listOfCategories();
|
return AudioBook::ListOfGenres();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function ListOfTypes()
|
public function ListOfTypes()
|
||||||
@@ -393,7 +390,7 @@ class NetBiblio extends WebService
|
|||||||
if($type == 'Jeunesse') {
|
if($type == 'Jeunesse') {
|
||||||
$s->addQuery(1, 'jeunesse');
|
$s->addQuery(1, 'jeunesse');
|
||||||
} else {
|
} else {
|
||||||
$s->addQuery($type, 'category');
|
$s->addQuery($type, 'genre');
|
||||||
}
|
}
|
||||||
$s->addSortField('availabilityDate');
|
$s->addSortField('availabilityDate');
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user