Search se:alternate-title when searching ebooks

This commit is contained in:
Alex Cabal 2020-05-29 12:42:14 -05:00
parent 9af540a68d
commit 98ad906c11

View file

@ -30,6 +30,7 @@ class Ebook{
public $DistCoverUrl;
public $Title;
public $FullTitle;
public $AlternateTitle;
public $Description;
public $LongDescription;
public $Language;
@ -154,6 +155,8 @@ class Ebook{
$this->FullTitle = $this->NullIfEmpty($xml->xpath('/package/metadata/dc:title[@id="fulltitle"]'));
$this->AlternateTitle = $this->NullIfEmpty($xml->xpath('/package/metadata/meta[@property="se:alternate-title"]'));
$date = $xml->xpath('/package/metadata/dc:date');
if($date !== false && sizeof($date) > 0){
$this->Timestamp = new DateTime((string)$date[0]);
@ -381,10 +384,12 @@ class Ebook{
}
public function Contains(string $query): bool{
// When searching an ebook, we search the title, author(s), SE tags, and LoC tags.
// When searching an ebook, we search the title, alternate title, author(s), SE tags, and LoC tags.
$searchString = $this->FullTitle ?? $this->Title;
$searchString .= ' ' . $this->AlternateTitle;
foreach($this->Authors as $author){
$searchString .= ' ' . $author->Name;
}