It's necessary to remove these headers now that the file download
redirects to `www/ebooks/download.php`. If not, the browser raises an
error about the header set twice.
This commit adds a rewrite rule for ebook downloads of the form:
```
/ebooks/some-author/some-book/downloads/some-filename.epub
```
to `www/ebooks/download.php`. That file handles the logic of whether to
show a thank you page before beginning the download.
Download URLs in RSS, Atom, and OPDS feeds follow the same pattern, but
they have a query string parameter `?source=feed` to always skip the
thank you page.
See #484 for details. By adding a special case for hyphens, users can
search for these terms:
`beta` to match `Alpha-Beta`
`queen` to match `Haycraft-Queen`
These searches also work as expected:
`Alpha-Beta`
`Alpha`
`Haycraft-Queen`
`Haycraft`
I don't think these queries should work, and they do not:
`AlphaBeta`
`HaycraftQueen`
This commit changes `IndexableText`, `IndexableAuthors`, and
`IndexableCollections`, so existing DBs need an update. This will update
all published books:
```
cd /standardebooks.org/ebooks
for BOOK in $(find /standardebooks.org/ebooks -maxdepth 1 -type d)
do
tsp nice /standardebooks.org/web/scripts/deploy-ebook-to-www --verbose --no-build --no-images --no-recompose --no-epubcheck --no-feeds --no-bulk-downloads "$BOOK"
done
```
And this PHP code will update placeholders:
```
<?
require_once('/standardebooks.org/web/lib/Core.php');
$ebooks = Ebook::GetAll();
foreach($ebooks as $ebook){
if($ebook->IsPlaceholder()){
print('Saving ' . $ebook->Identifier . "\n");
// Need to force `Ebook::GetAllContributors()` to be called before `Ebook::Save()`. Otherwise, authors and translators will be deleted.
$ebook->Authors;
$ebook->Save();
}
}
```
That is, don't replace non-alphanumerics with a space. This matches the
behavior of Formatter::RemoveDiacriticsAndNonalphanumerics(), which
would be used here except that function would also remove quotes. We
actually discussed not introducing spaces previously, but I made a
mistake and didn't apply the same change to the user's search query:
https://github.com/standardebooks/web/pull/470#discussion_r1929591492
This change fixes queries with compound words like:
`Haycraft-Queen`
and also fixes queries for authors with apostrophes:
`O'Neill`
No changes to existing DBs are necessary because they already have terms
like `haycraftqueen` and `oneill` stored in `IndexableCollections` and
`IndexableAuthors`.