显示标签为“newbie”的博文。显示所有博文
显示标签为“newbie”的博文。显示所有博文

2012年3月25日星期日

Full Text search in SQL Server 2005 Express?

Newbie questions.

1. Can SQL Server 20005 Express do full text searches?

2. If not, is there a way to use SQL Server 20005 Express to search a database column containing text data type?

Using Visual Basic 2005 Express, I would like to do a simple search with a search textbox and button that will return the entire contents of a field of database text when one or more words in the search text box are in the field of text in the database.

I have been playing in Visual Basic 2005 Express and using SQL queries (SELECT, FROM, WHERE) to output to DataGridView controls by using ID columns as filters in the query, etc. This I can do. But I have not been able to use a word or phrase in the search textbox as a filtered query to output the entire database field of text which contains the search word or phrase in the search textbox.

Thanks for any help in getting me started with this.

SQL express with advanced services offers full text search. Take a look at the FreeText sql statement for full text searches.|||

Thanks Ken.

I will get the Advanced Services version of SQL Express and work on learning to use the full text search feature.

sql

2012年3月22日星期四

Full text search and typo?

I am a newbie in full text search. Please bare with me if this has been asked a thousand times, coz I couldn't seems to find anything related to this on google or this forumn.

I am just wondering how I can implement my MS SQL server (with full text search) that can handle typo?

For example, if someone enters "mirosoft" to search for microsoft, how can I handle stuff like that ?

Thx a lot

I don't think it is possible the same in SQL Server, as I have never come across of correcting the typo. Probably you need to have a applet that checks for such corrections as similar to Word.|||

While spelling corrections and google-like "suggestions" are not directly supported using MS SQL Server with Full text Search (FTS), if you are using SQL Server 2005 FTS, you can use the Thesaurus function and XML Thesaurus file to get close to what you are looking for. However, you will need first to identify the miss-spelled words and place them in the Thesaurus file (see SQL Server 2005 BOL "Configuring Thesaurus Files" for details). Let me know if you need more details on this.

Thanks,
John

SQL Full Text Search Blog
http://jtkane.spaces.live.com/

2012年3月19日星期一

Full text newbie...

Hi, group,
Made these days some tests and not understand very clear how contains or
containstable perform the search.
The catalog was built on 2...5 columns, various scenarios.
I tried with 2 words I am sure they exists in 2 different fields, but
contains nor containstable does not return those records. I tried both
"Johny Walker" and "Johny" AND "Walker" and no succes.
Is there any syntax allowing me to find "Johny" in a field AND "Walker" in
other field, in the same record, both fields included in FT catalog?
Thank you,
Renato
Not really. Both words must be in the same column with a Contains search, a
FreeText search can look across columns.
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
"Renato Aranghelovici" <renatoa@.rdslink.ro> wrote in message
news:OYRS%234SIGHA.3000@.TK2MSFTNGP14.phx.gbl...
> Hi, group,
> Made these days some tests and not understand very clear how contains or
> containstable perform the search.
> The catalog was built on 2...5 columns, various scenarios.
> I tried with 2 words I am sure they exists in 2 different fields, but
> contains nor containstable does not return those records. I tried both
> "Johny Walker" and "Johny" AND "Walker" and no succes.
> Is there any syntax allowing me to find "Johny" in a field AND "Walker" in
> other field, in the same record, both fields included in FT catalog?
> Thank you,
> Renato
>
|||Ok, thank you.
This responded only partially to my initial request: if I want to find all
records that contains "Johny" in any indexed field AND "Walker" in other
indexed field ( or both in the same field) is this possible with free text
search ? And how?
Thank you,
Renato
"Hilary Cotter" <hilary.cotter@.gmail.com> wrote in message
news:u1CeLYVIGHA.3348@.tk2msftngp13.phx.gbl...
> Not really. Both words must be in the same column with a Contains search,
> a FreeText search can look across columns.
> --
> 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
> "Renato Aranghelovici" <renatoa@.rdslink.ro> wrote in message
> news:OYRS%234SIGHA.3000@.TK2MSFTNGP14.phx.gbl...
>

2012年2月24日星期五

FULL Backup question

Hello everybody,
I am very newbie in sqlserver and I would to ask you a question.
I would like to backup my database through backup wizard and I would
like to automatic it for everyday full backup. What to you think it is
better database maintenance planner or backup wizard.
Could someone help me on that?
inaIf you are only doing a scheduling for a backup, I would use the richer
backup wizard rather than the maintainance wizard.
HTH, Jens Suessmeyer.
--
http://www.sqlserver2005.de
--|||so I need to go to tools/ database backups/ select database and the
device; in my case is file E:/... because you already do the full
backup or all server. I am learning SQL server and for the moment I do
not know scrpts very well so I do not want to do that at the moment.
It is true like this or Do I need to do others manipulations?
Ina

FULL Backup question

Hello everybody,
I am very newbie in sqlserver and I would to ask you a question.
I would like to backup my database through backup wizard and I would
like to automatic it for everyday full backup. What to you think it is
better database maintenance planner or backup wizard.
Could someone help me on that?
inaIf you are only doing a scheduling for a backup, I would use the richer
backup wizard rather than the maintainance wizard.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--|||so I need to go to tools/ database backups/ select database and the
device; in my case is file E:/... because you already do the full
backup or all server. I am learning SQL server and for the moment I do
not know scrpts very well so I do not want to do that at the moment.
It is true like this or Do I need to do others manipulations?
Ina

2012年2月19日星期日

FTS newbie - Searching accross multiple tables using CONTAINSTABLE

Hi all
I have a database with a number of tables with related information. I would
like to do a search across all these tables using AND, OR etc, which means
using CONTAINSTABLE, right?
Using something like:
searchStr = "dog AND cat"
SELECT a FROM parenttable
WHERE parentid IN
(SELECT [KEY] FROM CONTAINSTABLE(childtable1, *, searchStr))
OR parentid IN
(SELECT [KEY] FROM CONTAINSTABLE(childtable2, *, searchStr))
I get some results... The problem is, of course, that this means that both
dog and cat have to be in each child table, but I want to get all parent
table rows where dog AND cat appear ANYWHERE in the child tables (eg cat in
one and dog in the other, or both in one child table and none in the other,
and so on). Is this possible? Any suggestions?
This would be used on a search page on an ASP site. The real tables are more
like grandparent - parent - child, child, child.
Thanks a lot in advance!
Marcus
does the key column correspond to the pk of the parent table?
If so, this should work.
|||Thanks for the reply!
"Hilary Cotter" <hilaryk@.att.net> wrote in message
news:3BEBA99D-395A-4186-AAC6-6F22F7FE9E28@.microsoft.com...
> does the key column correspond to the pk of the parent table?
> If so, this should work.
Yes, the key column corresponds to the pk of the parent, but it doesn't
work. I am testing on some records where all the rows of child1 contain
"cat" and all the rows of child2 contain "dog". If I set the search string
to "cat" I get all the parent rows, like I should. Likewise, I get all rows
if I set the search string to "dog", of course. However, if I set the search
string to "cat AND dog" I get no rows.
This is not particularly surprising to me, since each "child query" executed
independently returns zero keys for "cat AND dog". Am I missing something
here? What can I do?
Here's the query again, for readability:
SELECT a FROM parenttable
WHERE parentid IN
(SELECT [KEY] FROM CONTAINSTABLE(childtable1, *, searchStr))
OR parentid IN
(SELECT [KEY] FROM CONTAINSTABLE(childtable2, *, searchStr))
Thank you!
Regards,
Marcus
|||No replies... So I take it this is not possible? Any suggestions on other
solutions?
Thanks,
Marcus
"Marcus" <lumbus@.ludd.luth.se> wrote in message
news:uXlNUDROEHA.2876@.TK2MSFTNGP09.phx.gbl...
> Thanks for the reply!
> "Hilary Cotter" <hilaryk@.att.net> wrote in message
> news:3BEBA99D-395A-4186-AAC6-6F22F7FE9E28@.microsoft.com...
> Yes, the key column corresponds to the pk of the parent, but it doesn't
> work. I am testing on some records where all the rows of child1 contain
> "cat" and all the rows of child2 contain "dog". If I set the search string
> to "cat" I get all the parent rows, like I should. Likewise, I get all
rows
> if I set the search string to "dog", of course. However, if I set the
search
> string to "cat AND dog" I get no rows.
> This is not particularly surprising to me, since each "child query"
executed
> independently returns zero keys for "cat AND dog". Am I missing something
> here? What can I do?
> Here's the query again, for readability:
> SELECT a FROM parenttable
> WHERE parentid IN
> (SELECT [KEY] FROM CONTAINSTABLE(childtable1, *, searchStr))
> OR parentid IN
> (SELECT [KEY] FROM CONTAINSTABLE(childtable2, *, searchStr))
> Thank you!
> Regards,
> Marcus
>
|||Marcus,
I had assumed that from your previous "Thanks for the reply" reply that the
[Primary] key (PK) column corresponds to the PK in the parent table and
therefore is solution was viable for you. Is that not correct? If so, then
could you provide more details on your table structures and the real SQL FTS
query?
Thanks,
John
"Marcus" <lumbus@.ludd.luth.se> wrote in message
news:uBT$PwdPEHA.4036@.TK2MSFTNGP12.phx.gbl...[vbcol=seagreen]
> No replies... So I take it this is not possible? Any suggestions on other
> solutions?
> Thanks,
> Marcus
> "Marcus" <lumbus@.ludd.luth.se> wrote in message
> news:uXlNUDROEHA.2876@.TK2MSFTNGP09.phx.gbl...
string[vbcol=seagreen]
> rows
> search
> executed
something
>
|||John,
Thanks for the reply. Either I'm missing something here or there is some
confusion about what I'm looking for. I'll try to explain this very clearly:
My real tables are pretty complicated and I think they will only confuse. I
have made a test database that looks like this:
TABLE [Parent]:
[ParentID] [int] IDENTITY (1, 1) NOT NULL
[Data] [varchar] (100)
TABLE [Child1]:
[ParentID] [int] NOT NULL ,
[Data] [varchar] (100)
TABLE [Child2]:
[ParentID] [int] NOT NULL ,
[Data] [varchar] (100)
I then insert the following rows:
TABLE [Parent]:
ParentID=1, Data='dummy'
TABLE [Child1]:
ParentID=1, Data='the dog says woof'
TABLE [Child2]:
ParentID=1, Data='the cat says miau'
Now, remember: What I want to do is to search for "dog AND cat" in this
structure, returning the IDs for the parent rows where the words "cat and
"dog" appear anywhere in the tables, for example "cat" in Child1 and "dog"
in Child2.
This query...
SELECT ParentID FROM Parent
WHERE ParentID IN
(SELECT [KEY] FROM CONTAINSTABLE(Child1, *, 'cat AND dog'))
OR ParentID IN
(SELECT [KEY] FROM CONTAINSTABLE(Child2, *, 'cat AND dog'))
...returns nothing. This is the problem I'm asking about.
Just to show that the tables are healthy, this query...
SELECT ParentID FROM Parent
WHERE ParentID IN
(SELECT [KEY] FROM CONTAINSTABLE(Child1, *, 'cat OR dog'))
OR ParentID IN
(SELECT [KEY] FROM CONTAINSTABLE(Child2, *, 'cat OR dog'))
...returns ParentID=1. And these queries...
SELECT [KEY] FROM CONTAINSTABLE(Child1, *, 'cat OR dog')
SELECT [KEY] FROM CONTAINSTABLE(Child2, *, 'cat OR dog')
...return KEY=1.
So the question is whether there is a solution to this or whether I should
give up on using FTS for my search functionality.
Thank you!
Regards,
Marcus
"John Kane" <jt-kane@.comcast.net> wrote in message
news:Op2OC3gPEHA.3524@.TK2MSFTNGP09.phx.gbl...
> Marcus,
> I had assumed that from your previous "Thanks for the reply" reply that
the
> [Primary] key (PK) column corresponds to the PK in the parent table and
> therefore is solution was viable for you. Is that not correct? If so, then
> could you provide more details on your table structures and the real SQL
FTS[vbcol=seagreen]
> query?
> Thanks,
> John
>
> "Marcus" <lumbus@.ludd.luth.se> wrote in message
> news:uBT$PwdPEHA.4036@.TK2MSFTNGP12.phx.gbl...
other[vbcol=seagreen]
doesn't[vbcol=seagreen]
contain
> string
> something
>

FTS Newbie - Help Please!

Hi!
I've got a table SupplierItem with full text catalogue set up on it
and I need to search two columns of it, Description2 and
SupplierItemCode, for any combination of terms entered in any order
with wildcards
(ie if user puts in FOLDER, it finds FOLDERS as well) and also search
for two columns non-FTS for
possible entries as well. I've played around with wildcards, CONTAINS
but it still doesn't work properly!!
Please help...
Here's the example:
SELECT
SupplierProduct.SupplierProductId,
SupplierProduct.SupplierProduct,
CurrentItem.SupplierItemId,
CurrentItem.SupplierItemCode,
CurrentItem.Description2,
CurrentItem.BuyUnit,
CurrentItem.PricingUnit,
CurrentItem.OCCost,
CurrentItem.OCCost1,
CurrentItem.OCCost2,
CurrentItem.OCCost3,
CurrentItem.ConnCost,
CurrentItem.ConnCost1,
CurrentItem.ItemStatusId,
ItemStatus.ItemStatusName,
ItemStatus.ItemStatusImage,
ItemStatus.ItemStatusColour,
Supplier.SourceCode,
CurrentItem.UnitId,
CatalogueItem.Item
FROMSupplierItem CurrentItem
INNER JOIN SupplierProduct ON (CurrentItem.SupplierProductId =
SupplierProduct.SupplierProductId)
INNER JOIN Supplier ON (Supplier.SupplierId =
SupplierProduct.SupplierId)
INNER JOIN ItemStatus ON (CurrentItem.ItemStatusId =
ItemStatus.ItemStatusId)
INNER JOIN BaseProduct ON (BaseProduct.BaseProductId =
CurrentItem.BaseProductId)
LEFT OUTER JOIN CatalogueItem ON (CatalogueItem.BaseProductId =
BaseProduct.BaseProductId)
AND ((CatalogueItem.DateActive <= dbo.Date(year(getdate()), 1,1))
AND (CatalogueItem.DateArchived IS NULL OR CatalogueItem.DateArchived
> dbo.Date(year(getdate()), 12, 31) ))
WHERE(IsApproved = 1 -- item must be approved
AND (CurrentItem.DateArchived <= '1901-01-01') -- item must not be
archived
)
AND ( (@.SearchTerm IS NULL OR FREETEXT(CurrentItem.Description2,
@.SearchTerm))
OR (@.SearchTerm IS NULL OR FREETEXT(CurrentItem.SupplierItemCode,
@.SearchTerm))
OR @.SearchTerm = CatalogueItem.Item)
OR (@.SearchTerm = BaseProduct.BaseItem)
)
AND CurrentItem.OCCost > 0
ORDER BY
CurrentItem.SupplierItemId
What do you mean by it doesn't work? Are you able to find anything? Are
there any error messages?
RelevantNoise.com - dedicated to mining blogs for business intelligence.
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
"masterslave" <touchdowntokyo@.gmail.com> wrote in message
news:1193969441.786616.323720@.i38g2000prf.googlegr oups.com...
> Hi!
> I've got a table SupplierItem with full text catalogue set up on it
> and I need to search two columns of it, Description2 and
> SupplierItemCode, for any combination of terms entered in any order
> with wildcards
> (ie if user puts in FOLDER, it finds FOLDERS as well) and also search
> for two columns non-FTS for
> possible entries as well. I've played around with wildcards, CONTAINS
> but it still doesn't work properly!!
> Please help...
> Here's the example:
> SELECT
> SupplierProduct.SupplierProductId,
> SupplierProduct.SupplierProduct,
> CurrentItem.SupplierItemId,
> CurrentItem.SupplierItemCode,
> CurrentItem.Description2,
> CurrentItem.BuyUnit,
> CurrentItem.PricingUnit,
> CurrentItem.OCCost,
> CurrentItem.OCCost1,
> CurrentItem.OCCost2,
> CurrentItem.OCCost3,
> CurrentItem.ConnCost,
> CurrentItem.ConnCost1,
> CurrentItem.ItemStatusId,
> ItemStatus.ItemStatusName,
> ItemStatus.ItemStatusImage,
> ItemStatus.ItemStatusColour,
> Supplier.SourceCode,
> CurrentItem.UnitId,
> CatalogueItem.Item
> FROM SupplierItem CurrentItem
> INNER JOIN SupplierProduct ON (CurrentItem.SupplierProductId =
> SupplierProduct.SupplierProductId)
> INNER JOIN Supplier ON (Supplier.SupplierId =
> SupplierProduct.SupplierId)
> INNER JOIN ItemStatus ON (CurrentItem.ItemStatusId =
> ItemStatus.ItemStatusId)
> INNER JOIN BaseProduct ON (BaseProduct.BaseProductId =
> CurrentItem.BaseProductId)
> LEFT OUTER JOIN CatalogueItem ON (CatalogueItem.BaseProductId =
> BaseProduct.BaseProductId)
> AND ((CatalogueItem.DateActive <= dbo.Date(year(getdate()), 1,1))
> AND (CatalogueItem.DateArchived IS NULL OR CatalogueItem.DateArchived
> WHERE (IsApproved = 1 -- item must be approved
> AND (CurrentItem.DateArchived <= '1901-01-01') -- item must not be
> archived
> )
> AND ( (@.SearchTerm IS NULL OR FREETEXT(CurrentItem.Description2,
> @.SearchTerm))
> OR (@.SearchTerm IS NULL OR FREETEXT(CurrentItem.SupplierItemCode,
> @.SearchTerm))
> OR @.SearchTerm = CatalogueItem.Item)
> OR (@.SearchTerm = BaseProduct.BaseItem)
> )
> AND CurrentItem.OCCost > 0
> ORDER BY
> CurrentItem.SupplierItemId
>
|||Sorry for being really vague... The problem is I'm getting error
messages like this seemingly randomly:
Execution of a full-text operation failed. A clause of the query
contained only ignored words.
I've got a search log but if I try to replicate the search terms I
don't get the error... I've emptied the
words file in SQL Server, but it's still happening!
And the other issue is that it's very slow. The database has about
half a million records, but the query
takes at least five seconds to run...
Any help very much appreciated!!
On Nov 2, 3:05 pm, "Hilary Cotter" <hilary.cot...@.gmail.com> wrote:
> What do you mean by it doesn't work? Are you able to find anything? Are
> there any error messages?
> --
> RelevantNoise.com - dedicated to mining blogs for business intelligence.
> Looking for a SQL Server replication book?http://www.nwsu.com/0974973602.html
> Looking for a FAQ on Indexing Services/SQL FTShttp://www.indexserverfaq.com"masterslave" <touchdownto...@.gmail.com> wrote in message
> news:1193969441.786616.323720@.i38g2000prf.googlegr oups.com...
>
>
>
> - Show quoted text -