[API] Fully functional filename search
- Indexing on text fields cannot handle medium-size text inputs.
- Indexing on to_tsvector(...) cannot handle certain large text inputs (limit depends on content, not just size). Result: crash when creating the index or when inserting a row, whichever happens last.
- Add a tsvector column. Populate it with to_tsvector(...) where possible. Where not possible, either populate with partial content (to_tsvector(substring(...))), or leave it null and adjust the search query to do an unindexed fulltext search on such rows. A function with an exception clause might work.
- Use something other than Postgresql for text search.
#3 Updated by Peter Amstutz 10 days ago
Postgres text search has other problems when it comes to segmenting filenames. However I don't think that means we give up postgres, should create our own filename search table that has the behavior we want.
Maintain our own filename index in a new table.
keyword → collection PDH
Perform custom filename tokenizing and support prefix search with "like" (can use B-tree indexes). Split on symbols like "_", "-" and ".", CamelCase (lower&arr;upper transitions). Convert everything to lowercase. For example:
Would turn into:
Searches would be prefix searches, eg a search on "RMF1U7F" would be
keyword like 'rmf1u7f%'