Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Other Technologies / Full-Text Search / October 2004

Tip: Looking for answers? Try searching our database.

get text near key words

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rainbow - 28 Oct 2004 04:20 GMT
When i query key words , i can get the docname,doctype
etc.

Can i get some texts near the searching words ? like the
result fo google !

Does the MSSearch.Query offer one interface ?
Does the IFilters(according the doc type) offer one
interface to get some text from the doc?

thanks :)
John Kane - 28 Oct 2004 04:57 GMT
Rainbow,
Are these questions related to "Indexing Service" or SQL Server's Full-text
Search (FTS) components? If the latter, then have you checked out the NEAR
parameter within CONTAINS or CONTAINSTABLE, for example:

E. Use CONTAINS with <proximity_term>
This example returns all product names that have the word "Boysenberry" near
the word "spread".

USE Northwind
GO
SELECT ProductName FROM Products WHERE CONTAINS(ProductName, 'spread NEAR
Boysenberry')orSELECT FT_TBL.Description,    FT_TBL.CategoryName,
KEY_TBL.RANKFROM Categories AS FT_TBL INNER JOIN
  CONTAINSTABLE (Categories, Description,
     '("sweet and savory" NEAR sauces) OR
     ("sweet and savory" NEAR candies)'      , 10   ) AS KEY_TBL
  ON FT_TBL.CategoryID = KEY_TBL.[KEY]
Both examples are from SQL Server 2000 BOL (books online).

If your questions are related to the Indexing Service, could you be more
specific about what you mean by one interface?

Thanks,
John

> When i query key words , i can get the docname,doctype
> etc.
[quoted text clipped - 7 lines]
>
> thanks :)
rainbow - 28 Oct 2004 06:36 GMT
Thanks , John , you misunderstand me .

What i want is to get the pure-text about 20 bytes near th
the searching words , it looks like :

When i search 'full-text' in one doc: "sql server full-
text searching reference, ..." , i also want to get the
text 'full-text searching reference,...' and so on.

like google , When you search something , you can get some
hints texts containing the searching words !

So , maybe MSSearch will return the offset of the doc ,
then reading 20 bytes beside the offset , using IFilter to
translate the bytes into text!

Just one idea , and i don't know how to implement !

thanks ~

>-----Original Message-----
>Rainbow,
[quoted text clipped - 22 lines]
>Thanks,
>John
John Kane - 28 Oct 2004 08:00 GMT
You're welcome, Rainbow,
That is why I asked the questions, to get more information and a better
clarification on what you are really after!

While not exactly what Google provides (or even the Indexing Services'
abstract/characterization), the following is as close as you can get using
T-SQL and SQL Server 2000 Full-text Search (FTS):

-- The following SQL FTS query on the pubs table pub_info will return rows
that match the FTS search word (books) and return test that is near the
search word from 20 characters before the search keyword (books) for a total
length of 100 characters.

use pubs
SELECT pub_id,  SubString(pr_info,PatIndex ('%books%',pr_info)-20,100)
FROM pub_info
 WHERE Contains(pr_info, 'books')

You can vary the patindex parameters (20 & 100 in the above query) to expand
or contract the amount of text that will be displayed. However, the MSSearch
does not provide any direct method of returning an offset of the word in the
row/document, nor do the various IFilters provide an means of translating
the bytes into text. In order to get this level of granularity, you would
have to write your own IFilter for types of document you would want store
and search in order to get the information you are looking for and this is a
non-trivial effort...

This is not an un-common request, given the impact that Google has had in
Full Text Search over the last couple of years, but alas this type of
feature is not available in SQL Server 2000....

Let me know if this comes closer to what you're interested in doing!
Thanks,
John

> Thanks , John , you misunderstand me .
>
[quoted text clipped - 49 lines]
> >Thanks,
> >John
rainbow - 29 Oct 2004 07:53 GMT
Thanks all ~

I will add one doc abstract field to help to decide which
doc will best match the searcher's request ! This is one
simplest way to provide more text to the searcher !

Best regards !
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.