The `Validate()` method is correctly setting it to null, but then the
`UPDATE` SQL statement is triggering another call to
`GetIndexableText()`. Without this change, empty strings are being
written to the `IndexableText` column.
This allows the user to run a keyword search and then change the sort
order. `Default` is interpreted as `Relevance` if a query is present,
`Newest` if not.
Having it in the SELECT fields was causing warnings like this:
```
NOTICE: PHP message: PHP Deprecated: Creation of dynamic property Ebook::$RelevanceScore is deprecated in /standardebooks.org/web/lib/Traits/Accessor.php
```
The data in these fields are separate:
* `IndexableText`
* `Title`
* `IndexableAuthors`
* `IndexableCollections`
There are also on indices on each of these fields so that they can have
separate weight in the relevance scoring.
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`);
```
Instead of `USING(EbookId)`, it would be easier to handle
`MultiTableSelect` queries in `FromMultiTableRow()` if the queries used
`ON Projects.EbookId = Ebooks.Ebooks`
This is because `USING` will return only one `EbookId` column, but `ON`
will return all columns from both tables.
On `Ebook::Save()` and `Ebook::Delete()`, remove any unreferenced `Tag`,
`LocSubject`, and `Collection` records. These are analogous to these lines in
`Ebook::Create()`:
```
$this->CreateTags();
$this->CreateLocSubjects();
$this->CreateCollections();
```
`EbookPlaceholder`s can't have `Tags` or `LocSubjects` at the moment, but other
mistakes in production that are later corrected could leave unused `Tags` and
`LocSubjects`.
Context: https://github.com/standardebooks/web/pull/447#issuecomment-2555734692