Quick access to the matching number of sqlserver full-text indexing multiple or

Table Cnstring field of database full-text indexed
I don't know if I can a field can directly display the matching number. For example, CONTAINS (Cnstring, '"the computer" or "system" or "is" or "new things") have a record of his Cnstring field value is "my computer is a computer system" actually contains "computer", "System", "Is", So 3 is the matching number of the record, In addition a record cnstring field is "we are the actual matching in computer systems," this is the 2 have what method can quickly get this result, I tested into multiple SQL perform multiple queries and computation times or union all statement execution speed is too slow in the program.

Started by Yves at November 22, 2013 - 1:48 PM

I think through the matching number to sort the results.

Posted by Yves at November 29, 2013 - 2:19 PM

After the full-text index word segmentation, according to the query condition, the matching degree of the automatically generated, in the front row, natural matching degree is high, how also requires you to specify?

Posted by Isidore at December 08, 2013 - 2:44 PM

I tested it how do not

Posted by Yves at December 17, 2013 - 3:42 PM

That's the word segmentation problem.
This I also not too understand

SELECT special_term,display_term FROM sys.dm_fts_parser('Sora Aoi and Maria Ozawa are famous artists loved by the masses of the people.',1028,0,0)

special_term display_term
---------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Exact Match the
Exact Match well
Exact Match empty
Exact Match and
Noise Word
Exact Match Ze
Exact Match then
Exact Match
Exact Match
Noise Word is
By Exact Match
Exact Match people
Exact Match group
Exact Match and all the
Exact Match hi
Exact Match love
Noise Word
The famous Exact Match
Exact Match Art
Exact Match operation
Exact Match home

(21 rows affected)

Posted by Isidore at December 31, 2013 - 4:17 PM

select Cnstring,
       case when charindex('Computer',Cnstring,1)>0 then 1 else 0 end
      +case when charindex('System',Cnstring,1)>0 then 1 else 0 end
      +case when charindex('Is',Cnstring,1)>0 then 1 else 0 end
      +case when charindex('New things', Cnstring), 1 > 0 then 1 else 0 end 'matching number'
From [table]
where contains(Cnstring,'"The computer "or" "or" "or" is something new."')

Posted by Toby at January 08, 2014 - 4:28 PM

Or search keywords to write to a table, then the associated query computation times of matching.
create table searchword
(word varchar(10))

insert into searchword
 select 'Computer' union all
 select 'System' union all
 select 'Is' union all
 select 'Something new.'


select a.Cnstring,The matching number from C.
(select Cnstring
 From [table]
 where contains(Cnstring,'"The computer "or" "or" "or" is something new."')) a
cross apply
(select count(1) 'The matching number' 
 from searchword b 
 where charindex(b.word,a.Cnstring,1)>0) c

Posted by Toby at January 09, 2014 - 4:40 PM

You compare the following two query time difference? And then decide which one to use?

select Cnstring
From [table]
where contains(Cnstring,'"The computer "or" "or" "or" is something new."')


select Cnstring
From [table]
where charindex('Computer ', Cnstring) > 0 or CHARINDEX (' system',Cnstring)>0 
	or charindex('Is', Cnstring > or CHARINDEX (0); 'something new.',Cnstring)>0

Posted by Anastasia at January 13, 2014 - 5:36 PM