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

sql server full text search

group:

text search queries and vs or


text search queries and vs or tshad
4/29/2005 10:31:11 AM
sql server full text search:
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

Re: text search queries and vs or Hilary Cotter
4/29/2005 2:35:25 PM
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.

--
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