mirror of
https://github.com/standardebooks/web.git
synced 2025-07-16 03:16:36 -04:00
Add a Relevance
sort order and improve search
Here's what's in `IndexableText` right now: 1. Title 2. Collections 3. Authors 4. Tags 5. LocSubjects 6. TocEntries Here is the proposed new ranking: ``` 10 * Title + 8 * Authors + 3 * Collections + IndexableText ``` New indices for existing DBs: ``` ALTER TABLE `Ebooks` ADD COLUMN `IndexableAuthors` text NOT NULL; ALTER TABLE `Ebooks` ADD COLUMN `IndexableCollections` text NULL; ALTER TABLE `Ebooks` ADD FULLTEXT `indexSearchTitle` (`Title`); ALTER TABLE `Ebooks` ADD FULLTEXT `idxSearchAuthors` (`IndexableAuthors`); ALTER TABLE `Ebooks` ADD FULLTEXT `idxSearchCollections` (`IndexableCollections`); ```
This commit is contained in:
parent
b2df8a7018
commit
1a71913794
8 changed files with 120 additions and 15 deletions
|
@ -18,13 +18,17 @@ $isAllSelected = sizeof($tags) == 0 || in_array('all', $tags);
|
|||
</select>
|
||||
</label>
|
||||
<label>Keywords
|
||||
<input type="search" name="query" value="<?= Formatter::EscapeHtml($query ?? '') ?>"/>
|
||||
<input type="search" name="query" placeholder="Quotes allowed, e.g., "war and peace"" value="<?= Formatter::EscapeHtml($query ?? '') ?>"/>
|
||||
</label>
|
||||
<label class="sort">
|
||||
<span>Sort</span>
|
||||
<span>
|
||||
<select name="sort">
|
||||
<option value="<?= Enums\EbookSortType::Newest->value ?>"<? if($sort == Enums\EbookSortType::Newest){ ?> selected="selected"<? } ?>>S.E. release date (new → old)</option>
|
||||
<? if(isset($query) && $query != ''){ ?>
|
||||
<option value="<?= Enums\EbookSortType::Relevance->value ?>"<? if($sort == Enums\EbookSortType::Relevance){ ?> selected="selected"<? } ?>>Relevance</option>
|
||||
<? }else{ ?>
|
||||
<option value="<?= Enums\EbookSortType::Newest->value ?>"<? if($sort == Enums\EbookSortType::Newest){ ?> selected="selected"<? } ?>>S.E. release date (new → old)</option>
|
||||
<? } ?>
|
||||
<option value="<?= Enums\EbookSortType::AuthorAlpha->value ?>"<? if($sort == Enums\EbookSortType::AuthorAlpha){ ?> selected="selected"<? } ?>>Author name (a → z)</option>
|
||||
<option value="<?= Enums\EbookSortType::ReadingEase->value ?>"<? if($sort == Enums\EbookSortType::ReadingEase){ ?> selected="selected"<? } ?>>Reading ease (easy → hard)</option>
|
||||
<option value="<?= Enums\EbookSortType::Length->value ?>"<? if($sort == Enums\EbookSortType::Length){ ?> selected="selected"<? } ?>>Length (short → long)</option>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue