|
Home > Archive > SQL Server Full-Text Search > July 2005 > CONTAINS
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| Hi,
I have a table like this:
CREATE TABLE T1(
C1 int identity(1,1) PRIMARY KEY,
C2 NVARCHAR(50))
INSERT T1(C2) VALUES('test')
INSERT T1(C2) VALUES('Xtest')
INSERT T1(C2) VALUES('testX')
Assuming that C2 is enabled for FTS, this query does not return "Xtest":
SELECT * FROM T1 WHERE CONTAINS (*,'"*test*"')
It returns only "test" and "testX". How can I do that?
Thanks in advance,
Leila
| |
| Daniel Crichton 2005-07-18, 3:23 am |
|
"Leila" <Leilas@hotpop.com> wrote in message
news:O7ujWH2iFHA.3300@TK2MSFTNGP10.phx.gbl...
> Hi,
> I have a table like this:
>
> CREATE TABLE T1(
> C1 int identity(1,1) PRIMARY KEY,
> C2 NVARCHAR(50))
>
> INSERT T1(C2) VALUES('test')
> INSERT T1(C2) VALUES('Xtest')
> INSERT T1(C2) VALUES('testX')
>
> Assuming that C2 is enabled for FTS, this query does not return "Xtest":
>
> SELECT * FROM T1 WHERE CONTAINS (*,'"*test*"')
>
> It returns only "test" and "testX". How can I do that?
You can't, unless you use "Xtest" or "Xtest*". FTS doesn't handle suffix
searches, and so the leading * is ignored. Another option would be to fall
back to LIKE when a leading * is used.
Dan
| |
| Hilary Cotter 2005-07-18, 7:23 am |
| I think you mean prefix (comes before) which SQL FTS does not support. SQL
FTS does support suffix (comes at the end) type searches when you use the
wildcard operator in the Contains predicate.
--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Daniel Crichton" <msnews@worldofspack.co.uk> wrote in message
news:e1DACM3iFHA.3216@TK2MSFTNGP10.phx.gbl...
>
> "Leila" <Leilas@hotpop.com> wrote in message
> news:O7ujWH2iFHA.3300@TK2MSFTNGP10.phx.gbl...
>
> You can't, unless you use "Xtest" or "Xtest*". FTS doesn't handle suffix
> searches, and so the leading * is ignored. Another option would be to fall
> back to LIKE when a leading * is used.
>
> Dan
>
>
| |
| Daniel Crichton 2005-07-18, 7:23 am |
|
"Hilary Cotter" <hilary.cotter@gmail.com> wrote in message
news:%23RPqSH4iFHA.3064@TK2MSFTNGP15.phx.gbl...
>I think you mean prefix (comes before) which SQL FTS does not support. SQL
> FTS does support suffix (comes at the end) type searches when you use the
> wildcard operator in the Contains predicate.
Possibly, I can't remember which way around they go. If it refers to the
string part, it's suffix that isn't supported as the wildcard will be the
prefix. Thanks for pointing out my error though :)
Dan
| |
|
| Thank you all :-)
Then LIKE will be the only poosible way?
"Daniel Crichton" <msnews@worldofspack.co.uk> wrote in message
news:ek0j$34iFHA.3216@TK2MSFTNGP10.phx.gbl...
>
> "Hilary Cotter" <hilary.cotter@gmail.com> wrote in message
> news:%23RPqSH4iFHA.3064@TK2MSFTNGP15.phx.gbl...
SQL[color=darkred]
the[color=darkred]
>
> Possibly, I can't remember which way around they go. If it refers to the
> string part, it's suffix that isn't supported as the wildcard will be the
> prefix. Thanks for pointing out my error though :)
>
> Dan
>
>
| |
| Hilary Cotter 2005-07-19, 1:23 pm |
| Unfortunately so.
--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Leila" <Leilas@hotpop.com> wrote in message
news:ehN0lR%23iFHA.576@tk2msftngp13.phx.gbl...
> Thank you all :-)
> Then LIKE will be the only poosible way?
>
>
> "Daniel Crichton" <msnews@worldofspack.co.uk> wrote in message
> news:ek0j$34iFHA.3216@TK2MSFTNGP10.phx.gbl...
> SQL
> the
the[color=darkred]
>
>
|
|
|
|
|