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 / April 2005

Tip: Looking for answers? Try searching our database.

text search queries and vs or

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
tshad - 29 Apr 2005 18:31 GMT
I am trying to set up a search query for users that just put in words with
no "AND"s or "OR"s.  I am curious if it is better to put "AND"s or "OR"s in
places where the user doesn't specifically specify it.

For example:

I have a database with Jobs.

If a person is looking for IT jobs and puts in:

Computer Network Software Hardware.

I can either put in ANDs or ORs.  There are potential problems with either.

If I send the string:

Computer and Network and Software and Hardware

I will only get 2 hits - the jobs that have all the words in them.

If I use:

Computer or Network or Software or Hardware

I get 15 hits.  This includes sales jobs nursing jobs etc which might have
the word computer in it.  I could also get jobs that talk about Networking
with people (also not an IT) job.  I assume this would be the better choice
as the IT Jobs may not have Hardware or Software in it and will get missed
in the "AND" scenario.

I am using a parsing function to add the and words as:

function ParseKeywords (keywords as string) as string
 keywords = Regex.Replace(keywords, "( )", " and ")
 keywords = Regex.Replace(keywords," and and "," ")
 keywords = Regex.Replace(keywords,"and or and","or")
 keywords = Regex.Replace(keywords,"and near and","near")
 ParseKeywords = keywords
end function

This will end up putting "and" between all the words.  I am thinking about
changing it to put "or"s in place of the "and"s as the default.  I have not
even looked at whether a phrase was entered yet.

Thanks,

Tom
Hilary Cotter - 29 Apr 2005 19:35 GMT
I would put in OR and then ensure that you rank by rank desc - you will have
to use ContainsTable or FreeTextTable for this. This way if you get a hit on
more than one of the words it should be ranked higher than a hit with only a
single word.

Signature

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

> I am trying to set up a search query for users that just put in words with
> no "AND"s or "OR"s.  I am curious if it is better to put "AND"s or "OR"s in
[quoted text clipped - 43 lines]
>
> Tom
 
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.