Thank you for the reply and the suggestion. Unfortunately, my access to the server is limited so I'm having to solve this in stock-build PHP and SQLite only, so no FTS1, 2 or 3, or MySQL, or anything I need to build 🙁. Anyway, I think I've solved it... kinda... Well, it works... ish...
Here's my approach:
The table - lets call it 'Pages' - has a 'Title' and 'Body' column which I want to be searchable.
Rows are added to 'Pages' in the usual way, but also, the 'Body' text is appended to the 'Title' text, all punctuation is removed and the text is split into words. Each word is then added to another table, called 'Search', which has columns referencing the row ID in 'Pages', the word itself and the index the word occurs within the 'Title' and 'Body' columns, ie: Title = 'Hello', Body='Hello everyone my name is dave'; 'my' has an index of 4 as it is the fourth word.
A select can then be performed on this table, grouped by reference ID and ordered by the count of ids and also ordered by the minimum word index. Basically, it weights the order so that if the search string occurs earlier in the text (effectively, the title), and there are more occurrences of the search string, it will be higher up in the results.
I have had to limit certain things to make sure it's relatively fast, though I am sure other systems are a LOT faster without the need for these limits. I have limited the indexable content to 5000 words per page - it's for a company website, so I don't think it'll ever need to seriously go beyond that but this is modifiable; just tested it with a massive lorem ipsum and it slows it down slightly ( by 0.1s) but this is more down to how I get snippets and bold the search terms - to fix this, I have had to make sure I only SELECT a certain amount of text from the 'Body' column from 'Pages' and not the whole shebang . It is case-insensitive, and the search is OR based - ie, if the search string is more than one word, it splits and selects WHERE OR. I can easily do something about this, but not weight the results to where it finds words next to each other... Any thoughts? Also, I haven't done anything about adjectives and plurals (-ing, -er and s) but I might be getting too far ahead of myself.
ta!