sql server - SQL Azure CONTAINS not returning all results -


we added free text search on following table:

| 1 | kayer-meyar |  | 2 | ka-me | 

but,

select *  names  contains(name, '"me*"') 

returns only:

| 1 | kayer-meyar | 

while,

select *  names  contains(name, '"ka*"') 

returns both:

| 1 | kayer-meyar | | 2 | ka-me | 

when run:

select *  sys.dm_fts_parser('"ka-me"', 1033, null, 0) 

returns:

ka-me ka me 

after searching , tuning problem have found 2 major fault in full-text searching:

  1. the hyphen might treated word break. return | 1 | kayer-meyar | when use '"me*"'. doesn't return | 2 | ka-me |. problem because condition allow word start (not end with or in middle) me + @ least 1 character . you can say, "then how come return | 1 | kayer-meyar | string me in middle of word ?". because fulltext serach not consider silgle word, consider 2 seperate word(something kayer meyar ) fullfill requrement(me*). again in case of ka-me recognize ka me rather single word , fail condition(though star me there no character after that)
  2. have tried rebuilding full-text index? .

now solution is: i have turn off stop list full text search query use query this(my table name mytable):

alter fulltext index on mytable set stoplist = off 

then run query. time desire result. enter image description here

and here full query:

--create table mytable --( --id int identity(1,1), --name varchar(max)  not null --)  ---- see if fulltext installed or not --select serverproperty('isfulltextinstalled')  ---- http://stackoverflow.com/questions/2306825/why-cant-i-create-this-sql-server-full-text-index ---- https://technet.microsoft.com/en-us/library/ms187317.aspx ---- http://stackoverflow.com/questions/2306825/why-cant-i-create-this-sql-server-full-text-index ---- http://stackoverflow.com/questions/2315577/sql-server-2008-full-text-search-on-a-table-with-a-composite-primary-key  --create unique index ui_mytable on mytable(id);  --select name sysindexes object_id('mytable') = id;  --create fulltext catalog ft default;   --create fulltext index on mytable(name)    --   key index ui_mytable   --   stoplist = system;   --go    --insert mytable(name) values('kayer-meyar'),('ka-me');   alter fulltext index on mytable set stoplist = off  select *  mytable  contains(name, '"me*"')  select * mytable  contains(name, '"ka*"') 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -