Skip to content

Small error in the tutorial regarding full text search #3910

@chris0385

Description

@chris0385

In https://www.h2database.com/html/tutorial.html#fulltext, the documentation writes to use the query:
SELECT T.* FROM FT_SEARCH_DATA('Hello', 0, 0) FT, TEST T WHERE FT.TABLE='TEST' AND T.ID=FT.KEYS[0];

This fails for the following reasons:

  • TABLE is a reserved keyword, it needs to be quoted.
  • FT.KEYS[0] doesn't exist - FT.KEYS[1] does. As far as I understood, array indexes start with 1

The correct query is therefore:
SELECT T.* FROM FT_SEARCH_DATA('Hello', 0, 0) FT, TEST T WHERE FT."TABLE"='TEST' AND T.ID=FT.KEYS[1];

Same issue in the next section, with the Lucene search (although I didn't test this one)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions