FTSModel associated to table with non-integer primary key
There's no good reason to use a non-integer primary key in SQLite (unless you're also using `WITHOUT ROWID` in your table). SQLite's btree uses a 64-bit integer internally to store the rowid of a given row. If you use an integer primary key, then it will utilize that internal rowid automatically.

If you want to use a hash, just store the hash in a secondary column with a unique index.

> The Notes table uses a non-integer primary key with hash text ids.

I'm not sure what "hash text ids" means. You mean a md5 or something? An md5 is 16-bytes...you could maybe 8 bytes of the hash and treat them as a 64-bit integer... `struct.unpack('q', checksum.digest()[:8])` ('q' for signed, 'Q' for unsigned).

Lastly, you could create an additional column on your FTSEntry model which stores the hash, but note that this is a TERRIBLE idea and will require a FULL TABLE SCAN every single time. Also it's silly to store the hash as `TEXT`...just store the bytes in a `BLOB` field. Thanks for the detailed answer.
As I said, this is a third party database, so unfortunately I cannot modify those poor design decisions without breaking the depending task.

Under the constraints above (that is Note has primary field `id = TextField(null=True, primary_key=True)`), is it possible store the hashes in the virtual table (which I'm creating from scratch) like `uid = SearchField()`, then do the search on the virtual table, sth like
```
NoteIndex
        .select()
        .where(NoteIndex.match(search_string))
```
and join the corresponding rows of the main table via a join where Note.id == NoteIndex.uid? Would that keep efficient? That's what I was saying in the last paragraph:

> Lastly, you could create an additional column on your FTSEntry model which stores the hash, but note that this is a TERRIBLE idea and will require a FULL TABLE SCAN every single time.

In the fts virtual table it is only efficient to join on the rowid/docid field of the virtual table. All other fields incur a full scan so you get O(n^2). Indexes have no effect on the virtual table. Possible? Yes. Performant? No, unless the table is small in which case you may not notice.
I'm working on a database for notes.
The Notes table uses a non-integer primary key with hash text ids.
I would like to do fulltext search on the notes, so I wanted to use the FTS functionality of SQLite, but I see that the main id there is an integer.

The typical peewee example proceeds like:
```
query = (Entry
         .select()
         .join(FTSEntry, on=(Entry.id == FTSEntry.docid))
         .where(FTSEntry.match('javascript AND canvas')))
```
But in my case the INTEGER docid does not correspond to the TEXT id.
What's the best approach to make a search query in this scenario?