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