all groups > sql server full text search > august 2005 >
You're in the

sql server full text search

group:

Abstracts for Full-Text Index entries


Abstracts for Full-Text Index entries Dave Hickson
8/17/2005 3:23:01 AM
sql server full text search:
When using Microsoft Index Server file system catalogs, the Index Server
generates 'abstracts' which give the user an 'at a glance' indication of the
entry contents. Does Full-Text Indexing within SQL Server provide such
abstracts?

I am developing a search facility for a web site where I want to combine
search results for static web pages (managed by Index Server) with Full-Text
search results from SQL. I'll union the two results sets. I can get
abstracts for the Index Server entries, but can't find anything that will
give me a similar abstracts for the SQL entries. I could just use column
contents, but I'd rather have something more in keeping with the Index Server
abstracts.

Anyone got any good ideas?

Re: Abstracts for Full-Text Index entries Hilary Cotter
8/17/2005 7:59:48 AM
Indexing services abstracts are the first 320 bytes of textual data in
Office documents or the contents of the description metatag for html
documents. If the html document does not have a description metatag, its the
first 320 bytes of the html document.

For sql you have to do something like this

declare @searchphrase varchar(20)

declare @MarkedupSearchPhrase varchar(20)

set @searchphrase='shadow'

set @MarkedupSearchPhrase ='<B>shadow</B>'

select --1,firstword=len(@searchphrase)-(len(substring(charcol,charindex(@se
archphrase,
charcol)-50,100))-charindex('shadow',substring(charcol,charindex(@searchphra
se, charcol)-50,100))),

--len(substring(charcol,charindex(@searchphrase, charcol)-50,100)),

MarkedUpColumn = case when len(charcol) >100 and
len(@searchphrase)-(len(substring(charcol,charindex(@searchphrase,
charcol)-50,100))-charindex(@SearchPhrase,substring(charcol,charindex(@searc
hphrase, charcol)-50,100))) <>-1 then
replace(ltrim(substring(replace(substring(charcol,charindex(@searchphrase,
charcol)-50,100),@searchphrase,@MarkedupSearchPhrase),1,len(replace(substrin
g(charcol,charindex(@searchphrase,
charcol)-50,100),@searchphrase,@MarkedupSearchPhrase))-
len(left(reverse(replace(substring(charcol,charindex(@searchphrase,
charcol)-50,100),@searchphrase,@MarkedupSearchPhrase)),charindex('
',reverse(replace(substring(charcol,charindex(@searchphrase,
charcol)-50,100),@searchphrase,@MarkedupSearchPhrase))))))),char(13)+char(10
),' ')

when len(charcol) >100 and
len(@searchphrase)-(len(substring(charcol,charindex(@searchphrase,
charcol)-50,100))-charindex(@SearchPhrase,substring(charcol,charindex(@searc
hphrase, charcol)-50,100))) =-1 then
replace(substring(charcol,charindex(@searchphrase,
charcol)-50,100),@searchphrase,@MarkedupSearchPhrase)

else replace(replace(substring(charcol,charindex(@searchphrase,
charcol)-50,100),@searchphrase,@MarkedupSearchPhrase),char(13)+char(10),' ')
end

from texttable where FreeText(*,@searchphrase)



this needs some more work as I have to correctly remove the first word or
word fragment in the markedupColumn (as long as its not the search phrase).
This also does inline hit highlighting.



For "true" abstracts like what indexing services delivers you should use the
left function.


--
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
[quoted text, click to view]

Re: Abstracts for Full-Text Index entries Dave Hickson
8/18/2005 2:51:13 AM
Thanks very much Hilary. I assume from your answer that there is therefore
no built-in support for such abstracts?

[quoted text, click to view]
Re: Abstracts for Full-Text Index entries Hilary Cotter
8/18/2005 6:23:46 AM
Not in this current version, or the next.

--
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
[quoted text, click to view]

AddThis Social Bookmark Button