Advantage Database: Full Text Search not returning results that start with the search string
-
25-06-2021 - |
Domanda
I have a problem with a Full Text Search index. I have a table with a character field size 30. I have created a full text search index on this field in order to have fast search operations on this field that are case insensitive. Now, when I do a query like: SELECT fieldname FROM tablename WHERE CONTAINS(fieldname, '123')
I get a few records that contain 123 in the specified fieldname. However, there are records in this table that start with 123 but these are not shown in the query result. In fact, it looks like the query only shows results that contain 123 after a preceding space character.
My full text search index looks like this:
CREATE INDEX idxname ON tablename (fieldname) CONTENT MIN WORD 1
I am using Advantage Database Server 9.1
Any ideas what could be wrong?
Thanks,
Jurgen
Soluzione
A search of the form CONTAINS(fieldname, '123')
will find entries that have 123
as an individual "word". It won't find 1234
or 4123
. You can use CONTAINS(fieldname, '123*')
to find records that have "words" that begin with 123
. And CONTAINS(fieldname, '*123*')
will find records that contain words with 123
anywhere in them.
Note that the search of the form *123*
is less efficient because it must scan the entire index.