Howto Do A Fulltext Search ?
Jan 14, 2008Hi,
I'm trying to do a fulltext search which returns the adjacent words also in the result, like u do a google search and it returns the paragraph containing the searched phrase.
Any tips ?
Hi,
I'm trying to do a fulltext search which returns the adjacent words also in the result, like u do a google search and it returns the paragraph containing the searched phrase.
Any tips ?
I have a table that contains words that will be used to search another table where FullText index has been created on searchable columns. I'm basically trying to run something like this:
SELECT t1.col1, t2.col3
FROM tbl1 t1, tbl2 t2
WHERE CONTAINS (t1.col1, t2.col1)
I know this won't work but is there a way to join these two tables so the words (t2.col1) can be passed as search conditions? There is no common key on both tables so normal join won't work. I'm trying to find a way to pass the search words from one table to another.
My site uses a text box to allow visitors to search products. I'm trying to design the SQL Statement to allow search's on full words, part words, and words/phrases regardless of the order the words are in.
E.g.
megger
meg
mft megger (proper order in the database is megger mft)
mft1710 (using 1710 should find the product)
This is my select statement (classic ASP)
Code:
<%
Dim RSResults__param5
RSResults__param5 = "xxx"
If (Request("searchme") <> "") Then
RSResults__param5 = Request("searchme")
End If
[Code] ....
I have create a table called tblcatalog with colums id(identity,primary key) and contents(varchar(100))
I have then created a full text catalog on that table and populated it.
Then i wrote the following query
"select contents from tblcatalog where contains(contents,'sample data')"
It is fetching 0 records even though u have 5 records with entries "sample data"
Can anyone tell me the solution immediately
bye
shanky
Apologies if this is not the correct place to put this.I wrote this query to perform a fulltext search on tblPages.SELECT * FROM tblPages,FREETEXTTABLE(tblPages, *,@searchTerm) searchTableWHERE [KEY] = tblPages.PageID ORDER BY RANK DESCWhere PageID is the primary key.The synax is correct but why does it never return any results?thanksmarc
View 2 Replies View RelatedHi,
I created the following table in which i created full text indexing for DocDatafld and TypeColumn was used as Type Column for DocDataFld field. I store Document name in the DocumentTitlefld and want to get the Document name and Document and want to display it in the front end application and give url for the document.
Documentidfld bigint
Documenttitlefld varchar
MimeTypefld varchar
DocDatafld varbinary(MAX)
TypeColumn varchar
and i am using the following query to get the contents, but not able to get the column values.
select documenttitlefld,docdatafld from Documentdatatbl Freetext(DocDatafld,'C')
Please help
I am Using a Full Text Search Engine to Search Members of My Site so getting a Problem in Paging Concept I Basically want FullText Search Should Return me the Row he has Found I Dont want to write a new Query to get total resulset
Please can anyone Help Me
I had problem when change database from sqlserver 2000 to sql express 2005.The fulltext index does not create automatically.Example: i use sqldatasource to insert new name to my table.and then i find it by query like this : select count(*) from mytable where contains(mycol,'newname')the result is 0but if i run query to start full index : exec sp_fulltext_catalog 'myfulltext','start_full' and run query select count(*) from mytable where contains(mycol,'newname')again. The result is 1. So i alway run exec sp_fulltext_catalog 'myfulltext','start_full' after insert or update, delete to create fulltext index. When i use sql server 2000 , i didn't need do that, it automatic. Pls help me !!! how to make fulltext index create auto in sql express 2005 .
View 1 Replies View RelatedSQL Server 2005:
Anyone know how best to rewrite this SQL string to perform a weighted search on my table?
here's my code:
SQL="SELECT RecipeName FROM recipeList WHERE FREETEXT(*,'ISABOUT " & ing01 & " WEIGHT (.1) or " & ing02 & " WEIGHT (.2) or " & ing03 & " WEIGHT (.3) or " & ing04 & " WEIGHT (.4) or " & ing05 & " WEIGHT (.5)')"
the idea is to get a list of recipes most pertinant to the ingredients entered.
table 'recipeList' contains the ingredients in several columns. so column 2 might say '5oz of flour', column 2 - '2oz butter' etc.
at the moment it returns the correct recipes but not in the right order.
If I use 'CONTAINS' it returns nothing.
hope that's not too vague!
I'm using full text search in sql server 2008 with contain keyword.
My issue is while I'm trying
select * from tbl_item_master where contains (ITM_FULLTEXT,'red and white')
above syntax gives me required output but while I'm trying
select * from tbl_item_master where contains (ITM_FULLTEXT,'red and the and white')
above syntax does not gives me output. I'm using system stop list and "the" is noise keyword.
I want to stop searching "the" but want result as per first syntax.
I do get warning " The full-text search condition contained noise word(s)."
Is it possible?
Hello,
I try to get the full-text search on SQL Server Express with advanced Services SP2
running, but I got some problems.
First I tell you what I did.
I created a new database called TestDB.
Then I created a TestTable inside the db with a Primary Key:
CREATE TABLE [dbo].[TestTable](
[id] [int] IDENTITY(1,1) NOT NULL,
[text] [ntext] COLLATE Latin1_General_CI_AS NULL,
CONSTRAINT [PK_TestTable] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Then I executed these commands:
sp_fulltext_database enable
create fulltext catalog testcatalog as default
create fulltext index on TestTable(text) key index PK_TestTable
Now the problem:
When I insert some rows in the Table the catalog get not populated.
(change Tracking Setting is set to auto)
Instead these error messages are written into the crawl log:
Error '0x80004005' occurred during full-text index population for table or indexed view
'[TestDB].[dbo].[TestTable]' (table or indexed view ID '2073058421', database ID '5'),
full-text key value 0x00000002. Attempt will be made to reindex it.
The component 'sqlfth90.dll' reported error while indexing.
Component path 'c:ProgrammeMicrosoft SQL Server90COMsqlfth90.dll'.
Can somebody give me a hint?
Greetings,
Phillip
I just implemented full text search on a table and it doesn't work like I expected. I am using a stored procedure to search a company name column.
CREATE PROCEDURE swsp_GetCompanyRecord
@companyName varchar(120)
as
begin
select recID, companyName
from TABLE
where contains (companyName, @companyName)
end
I use the stored procedure as follows:
swsp_GetCompanyRecord '"Reynolds Aluminum"' (Quotation marks inside single quote)
If I search for a company (e.g., Reynolds Aluminum), I get the following results:
Search Returns
Reynolds Reynolds Aluminum
Reynolds A Reynolds Aluminum
Reynolds Al nothing
Reynold nothing
Aluminum Reynolds Aluminum
I guess I expected this to work similar to 'LIKE' in that it would return the full company name if I gave it any portion of the name. Is there something wrong with the way I've implemented this?
Hello all
I am trying to full text search in the Documnt table in AdvantureWorks DB.
as in the video sample microsoft provided.
I create the unique index on DocumentID column and created the FullTextIndex:
create fulltext index on Production.Document
(
Document
Type column FileExtension
Language 0X0
)
Key index ui_ProductionDocument on MyFullTextCatalog
With change_tracking auto
Now I am trying to run the next search:
select * from Production.Document
where Contains(Document,'קורות')
and I get nothing back, what do I do wrong?????
Hello,I am using SQLServer Express and Visual Studio 2005 to create the website. I would like to implement FullText search, but have never done it before. I have looked at the msdn documentation on FullText search in SQLServer 2005 here http://msdn2.microsoft.com/en-us/library/ms142519.aspx.I cannot seem to figure out how to use a FT search using Visual Studio. Can someone please help me configure my database and then explain how I can run queries based on user input to return data?
View 5 Replies View RelatedI am using SSIS to replace set of tables daily. One of the table has primary, unique, foreign keys and full-text index. Before truncating, I am dropping the foreign key constraints (to truncate the parent table), truncating the tables and recreating the foreign keys.
I have few questions:
1) Do I need to drop and recreate the unique key as well? (I am not dropping the primary key) - Unique key is identity column created just for the full-text indexing since it was mentioned that key on integer is better than key on varchar and my pk is a varchar.
2) Do I need to drop and recreate the full-text index or just rebuild/repopulate it every time the table is loaded.
This is the first time i am using full text index and I was able to learn a lot about it from the sites. I would like to understand the correct approach while loading the tables.
Sorry, is this possible?
select * from COLLABORATOR x inner join
containstable
(CollaborAtor,*,
' ISABOUT (
"hiv and Gender" weight (.8)
or
"hiv or Gender" weight (.2)
)
'
)
as KEY_TBL
on x.ColId = KEY_TBL.[KEY]
==
basically I want all rows with either string, but I want those with both to rank first.
Also, how can I deal with singular vs plurals of words..
Thanks.
We have a table that is Full Text Search index enabled on one column.This table has 200 lakhs of rows(20000000) . ContainsTable() function is searching data with in these 200 lakhs of rows(20000000), if any new rows are inserted then the ContainsTable is not going to search in these recent inserted rows.
We observed when we try for a data to search. it is returning the rows till the rows that are inserted date is less than 30th of march 2012. but not searching in the records that are created after April month , if even the data we are searching is available .
TableFulltextItemCount is around 2.2 crores.
Then we done rebuilt the FT catalog Index. then the TableFulltextItemCount became 0.Again we run the containstable query ,but still it is not getting results.
As the no of rows are very more . so i am not able to show the actual rows from which the data is not coming.
the below query gives 2 results that are from actual base table
HTML Code:
select * from g_case_action_log where cas_details like '%235355%' and product_id = 38810
To search for the same above word using FTS,I have used the query as below
HTML Code:
SELECT Distinct top 50 cal.case_id,cal.cas_details From g_case_action_log cal (READUNCOMMITTED)inner join containstable(es.g_case_action_log, cas_details, ' ("235355" OR "<br>235355" OR "235355<br> ") ') as key_tbl on cal.log_id = key_tbl.[key] Where cal.product_id = 38810 ORDER By cal.case_id DESC
I have attached one sql script file for your ref that contains create logic and index schema properties
Why it is not returning results all the time.
I fought for days with the following problem: On our development server, FTS was very fast. When I deployed the database by backup/restore to an identical production server, the 1st query on FTS became incredibly slow, it took about 1 minute for a simple query like Select TOP 1 'a' from ic_ItemContents where CONTAINS(s_Title,'fund'). Subsequent searches would be fast - at least for a while. After FTS has not been used for about 1/2 hour, the next search committed was very slow again.
This of course lead to inacceptable response times for users.
I found out that our DB seems to have the problem described here - altough, in this article, it is not mentioned that it could have an impact on performance: http://support.microsoft.com/kb/910067.
After detaching and reattaching the database as decribed there, FTS is now really fast even on the first attempt, the problem has gone away.
System specs: SQL Server 2005 SP2, Windows 2003 SP2.
Perhaps this helps someone else with the same problem.
Regards,
- Urs
I'm just wonder if this is a bug in MS Search or am I doing something wrong.
I have a query below
declare @search_clause varchar(255)
set @Search_Clause = ' "hepatitis b" and "hepatocellular carcinoma"'
select * from results
where contains(finding,@search_clause)
I don't get the correct result at all.
If I change my search_clause to "hepatitis" and "hepatocellular carcinoma -- without the "b"
then i get the correct result.
It seems MS Search doesn't like the phrase contain one letter or some sort or is it a know bug?
Anyone know?
Thanks
Hello,I am using SQL 2005 and SQL Server Management Studio.How can I activate FullText in my database?Or should I do this only for the tables where I need it?How can I do this?Thank You,Miguel
View 1 Replies View RelatedUsing CONTAINS, we can search for "never*" and we will find "nevertheless".However, I would like to do the inverse: "*less" should also find"nevertheless". Strangely, I can't find that in the doc and it does not seemto work.Am I getting something wrong? Or is this really not possible?Thanks a lot for your hints,Matthias HaldimannPS: This "*whatever" search may not look THAT useful in English, but it isvery important for searches within German nouns.
View 1 Replies View RelatedCan I get a documentation about full text capacity and limitation like memory utilization, number of catalogs per server, no of rows in each catlaog for SQL Server 2000.
Thanks
Tanweer
I want to know that
what is Fulltext and what is Indexing? Is both the things are different from eachother or related.
And wht is the concept of Searching in SQL.
and last about Contains keyword.
Hi,I'm doing a search function for recipe database and have the query:1 SELECT K.RANK, tRecipe.sHeadline, tRecipe.sIngredients, tRecipe.sImagePath
2 FROM tRecipe
3 INNER JOIN
4 FaktaRecipe ON tRecipe.iRecipeID = FaktaRecipe.iRecipe
5 INNER JOIN
6 CONTAINSTABLE(tRecipe, *, 'ISABOUT (chick* WEIGHT(0.2))') AS K
7 ON tRecipe.iRecipeID = K.[KEY]
8 WHERE (FaktaRecipe.iRecipeFakta = 5)
9 ORDER BY RANK DESC I want to return records like 'chicken pie' etc, hence using the wildcard in chick* BUT the wildcard doesn't work! It works fine if I use the whole word 'chicken' but of course a user won't always do that... I am using SQL server 2000. Any ideas? - I'm tearing my hair out! Thanks,Paul
I cna't seem to ungrey the fts option. I've checked that mssearch is running and using the stored procs to manage fts results in
Server: Msg 7609, Level 17, State 2, Procedure sp_fulltext_database, Line 46
Full-Text Search is not installed, or a full-text component cannot be loaded.
but I have installed it!
Any ideas?
Hi All,
I am using SQL SERVER 2005 Express. I am trying to set up CREATE FULLTEXT INDEX.
I have confirmed that the Fulltext is installed with:
SELECT
fulltextserviceproperty('IsFulltextInstalled')
So no I need to create a Full Text index:
CREATE FULLTEXT INDEX
ON E190MELCDL(xmldata)
KEY INDEX PK_E190MELCDL
But I get this error:
Informational: No full-text supported languages found.
Informational: No full-text supported languages found.
Msg 7680, Level 16, State 1, Line 1
Default full-text index language is not a language supported by full-text search.
Any Ideas?
Thanks,
Bones
Hi Experts:
Do users will still have access to the FullText catalog while the catalog is optimized (not rebuilt)?. My assumption is that they should have the access. Can anyone please confirm?.
Thanks
AK
I've got fresh Installed SQLExpress 2005 Adv. with a following:
WinXP Pro, Developer PC, Admin/Full rights, Antivirus PC-Cilin was switched off for the installation.Enable User Instance - 0 (clear check box during installation)SQL Collation: Dictionary order case sensetive for1252 Char setSELECT @@language: us_englishcreate fulltext catalog testAPFullTextcatalog,
Sp_help_FullText_catalogs: 5 testAPFullTextcatalog C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLFTData estAPFullTextcatalog 0 0create unique index indexName_Comment on dbo.FullTextSearchTestTable(RecordID)
sp_configure:
allow updates 0 1 0 0
clr enabled 0 1 0 0
cross db ownership chaining 0 1 0 0
default language 0 9999 0 0
max text repl size (B) 0 2147483647 65536 65536
nested triggers 0 1 1 1
remote access 0 1 1 1
remote admin connections 0 1 0 0
remote login timeout (s) 0 2147483647 20 20
remote proc trans 0 1 0 0
remote query timeout (s) 0 2147483647 600 600
server trigger recursion 0 1 1 1
show advanced options 0 1 0 0
user instances enabled 0 1 0 0
user options 0 32767 0 0CREATE FULLTEXT INDEX ON dbo.FullTextSearchTestTable(Comment)
KEY INDEX indexName_Comment ON testAPFullTextcatalog
WITH CHANGE_TRACKING AUTO
Result:
Informational: No full-text supported languages found.
Informational: No full-text supported languages found.
Msg 7680, Level 16, State 1, Line 1Default full-text index language is not a language supported by full-text search.
I couldn't overcome the issue. Please help.
Alexei
P.S. May be Important: During installation (on Management Studio Express installation stage) a had to click twice the "Ignore" button for the following popUp message:
"Could not write value to key:
SoftwareClasses.xdropenWithProgIdsShared - verify, if you have sufficient access to hot key or contact your support.
We have a sql server 2000 active/passive cluster running on Windows Server 2003 and within the last 6 months have started getting the following errors which eventually cause the SQL Resource Group to failover.
An error occurred in the configuration monitor for instance <SQL Server Fulltext>: 80070005 - Access is denied.
SQL is at the latest service pack/hotfixes. (8.00.2187)
This cluster has been running fine for the past 3 years with no problems. Nothing has changed on the servers.
We've had Symantic Antivirus running on the servers for a long time but the FTDATA folder and the sql data and transaction logs are excluded and nothing has changed on the configuration.
We also run Diskeeper 2007 server on these servers but I can't see any problems with this.
Once it fails over it will run fine for several days and then the same errors will occur and it fails over again.
Any ideas on what might be causing this? I can't really find anything on the Microsoft site that matches this error.
Note: This has also just started happening on our test cluster which is an identical configuration.
I'm about ready to smash my computer. I've installed SQL Server 2005 Express Edition with Advanced Services on Win XP Pro SP2. I made sure to enable the Fulltext service at install. Installed to the default instance name, and made sure the fulltext service is running from the CM. I made sure to enable full text indexing on my database from the properties window. I can create the fulltext catalog, but not the index!
----
create fulltext index on [person.contact] (Lastname)
key index [PK_Person.Contact] on myfulltextcatalog
Informational: No full-text supported languages found.
Informational: No full-text supported languages found.
Msg 7680, Level 16, State 1, Line 1
Default full-text index language is not a language supported by full-text search.
----------------------------------------------
select * from sys.fulltext_catalogs
returns the catalog
----------------------------------------------
sp_fulltext_service 'update_languages'
Informational: No full-text supported languages found.
----------------------------------------------
select @@language
us_english
----------------------------------------------
select * from sys.fulltext_languages
Returns an empty table
----------------------------------------------
SELECT * FROM sys.configurations
ORDER BY name ;
1126 default full-text language 1033 0 2147483647 1033 default full-text language 1 1
----------------------------------------------
Does anyone have any idea what's going on? I've already removed and re-installed a couple of times to different directories, used different instance names, and still no luck. Any help would be greatly appreciated.
Mike
Hello all,I'm wanting to do a CONTAINS query on fields that belong to two seperate tables. So, for example, this is what I'd *like* to do :SELECT ci.itemNameFROM Content_Items ciINNER JOIN Content_Pages AS cp ON ci.contentItemId = cp.contentItemIdINNER JOIN FREETEXTTABLE(Content_Items, (ci.title, cp.pageText), @searchString) AS ft ON ci.contentItemId = ft.[KEY]However, this will not work, since SQL Server won't let you do fulltext queries against more then one table.So my idea is to create a view that combines my Content_Items table with the desired column from my Content_Pages table. I would then create a fulltext index on this view, and do fulltext queries against it.It seems like this should work. However, when I try to create a fulltext index on my newly-created view, I get this error :A unique column must be defined on this table/view.How do I create a unique column within a view?Also, will my approach work, or will it have unintended consequences? I'm using this as part of a search component in my software, so it has to perform reasonably well.
View 1 Replies View RelatedHello,
i have a database with about 300.000 entries. The database gets about 30 new entries every day. The Database has an FulltextIndex on several columns. This FulltextIndex will be updated every night.
But now i have found out, that the fulltextsearch doesn't work anymore for all entries that where added after April 2006.
When i for example make following sql-statementSELECT id,date FROM MyTable WHERE (CONTAINS((columnA),' "mykeyword" '))
i only get results that have a date after April 2006 (although there are matching entries after that date).
What can the reason for that be?
According to Management Studio the last Update of the FulltextCatalog has been made on 1st of December 2007. Everything looks normal and I didn't find any logs that are saying that there has been any errors.
Where do I have to look to be sure if the FullTextIndex does work?
Specs:
SQL Server 2005
Microsoft SQL Server Management Studio 9.00.1399.00Microsoft Analysis Services-Clienttools 2005.090.1399.00Microsoft Data Access Components (MDAC) 2000.086.3959.00 (srv03_sp2_rtm.070216-1710)Microsoft MSXML 2.6 3.0 6.0 Microsoft Internet Explorer 6.0.3790.3959Microsoft .NET Framework 2.0.50727.832Operating System 5.2.3790
greetings
Klaus
Hello all,
I'm wanting to do a CONTAINS query on fields that belong to two seperate tables. So, for example, this is what I'd *like* to do :
SELECT ci.itemName
FROM Content_Items ci
INNER JOIN Content_Pages AS cp ON ci.contentItemId = cp.contentItemId
INNER JOIN FREETEXTTABLE(Content_Items, (ci.title, cp.pageText), @searchString) AS ft ON ci.contentItemId = ft.[KEY]
However, this will not work, since SQL Server won't let you do fulltext queries against more then one table.
So my idea is to create a view that combines my Content_Items table with the desired column from my Content_Pages table. I would then create a fulltext index on this view, and do fulltext queries against it.
It seems like this should work. However, when I try to create a fulltext index on my newly-created view, I get this error :
A unique column must be defined on this table/view.
How do I create a unique column within a view?
Also, will my approach work, or will it have unintended consequences? I'm using this as part of a search component in my software, so it has to perform reasonably well.