SQLite User Forum

Search Forum
Login

Search Forum

(1.1) By Aask (AAsk1902) on 2025-02-05 01:09:48 edited from 1.0 [link] [source]

The Forum has a Search Forum faciliy. Is there a guide for using this facility?

In particular

  1. How to search for a precise word. Searching for .quit picks up quite: how to search for .quit?

  2. How to search for two phrases, say pragma and table?

  3. How to search for two phrases, say pragma or table?

(2) By midijohnny on 2025-02-05 22:18:11 in reply to 1.1 [link] [source]

I'm guessing here: but looking at the source code for 'Fossil' (which I believe this Forum is running on):

https://fossil-scm.org/home/file?name=src/search.c&ci=trunk

It says:

** The search can be either a per-query "grep"-like search that scans
** the entire corpus. Or it can use the FTS4 search engine of SQLite.
** The choice is an administrator configuration option.
**
** The first option is referred to as "full-scan search". The second
** option is called "indexed search".

It looks like this site might be configured for the 'grep like' search - rather than the FTS. (I tried a few FTS-style queries like "google AND pivot" and "pivot NEAR/5 pivot" etc - and they didn't seem to work).

I hope you get an authoritative reply to this question - I too would like to know how to get better search results !

(3) By jose isaias cabrera (jicman) on 2025-02-06 02:30:34 in reply to 2 [link] [source]

I opened this thread long time ago, but I have never been able to get good search results.

(4) By punkish on 2025-02-06 08:08:05 in reply to 2 [link] [source]

I too tried a few FTS-style queries here and didn't get anywhere. I wish this forum used FTS5 for search. I use that module significantly in my work but feel it doesn't get as much love as it should. That is understandable because the db itself is the main product and FTS5 is a side-hustle. But, by dog-fooding it, perhaps it would get more capabilities, better documentation, just more attention from the users as well as the developers.

(5) By Stephan Beal (stephan) on 2025-02-06 11:06:58 in reply to 2 [link] [source]

Or it can use the FTS4 search engine of SQLite.

Those docs are out of date. It was ported to fts5 sometime in the past year-ish and the docs will be updated momentarily.

This specific forum is configured to use fts5 and the Porter Stemmer. However...

Fossil does not accept the full fts5 syntax. Specifically, it performs the following translation when doing an fts5 search:

/*
** Expects a search pattern string. Makes a copy of the string,
** replaces all non-alphanum ASCII characters with a space, and
** lower-cases all upper-case ASCII characters. The intent is to avoid
** causing errors in FTS5 searches with inputs which contain AND, OR,
** and symbols like #. The caller is responsible for passing the
** result to fossil_free().
*/

Ergo, fts5 "AND" won't work - it will be treated like the plain word "and".

Full disclosure: i did write the above help text during the fts4-to-5 port but the code behind it existed long before that, and the "whys" of those limitations are unknown to me.

(6) By punkish on 2025-02-07 08:56:58 in reply to 5 [link] [source]

Ergo, fts5 "AND" won't work - it will be treated like the plain word "and".

So, is there some search-syntax-voodoo that we don't know that can make "AND" (and "OR" and "-", for exclude,) to work here?

(7) By Stephan Beal (stephan) on 2025-02-07 11:26:17 in reply to 6 [link] [source]

So, is there some search-syntax-voodoo that we don't know that can make "AND" (and "OR" and "-", for exclude,) to work here?

Nope, unless you're willing to (A) clone the forum to your machine and (B) patch your local fossil to do that.

Alternately, you can try to convince Richard that the search input should not be subject to its current treatment.

(8) By punkish on 2025-02-07 11:45:16 in reply to 7 [link] [source]

thanks for info and the suggestions, neither of which are appealing. I am happy to live with the current limitations :)

(9) By Max (Maxulite) on 2025-02-08 00:01:54 in reply to 8 [source]

While Google search is not an ideal solution introducing indexing lags and even missing some posts, you still can use it instead so, for example, a non-working fts5-compatible query in the forum

[ NEAR(sqlite3_step error, 5) ]

can be translated into the google one

[ site:https://sqlite.org/forum/forumpost/ sqlite3_step AROUND(5) error ]