[quoted text, click to view] "tshad" <tscheiderich@ftsolutions.com> wrote in message
news:%23cwfNZERFHA.3020@TK2MSFTNGP12.phx.gbl...
> "John Kane" <jt-kane@comcast.net> wrote in message
> news:uZjx6d9QFHA.244@TK2MSFTNGP12.phx.gbl...
>> Tom,
>> You have multiple word or phrase search condition and you need to wrap
>> both
>> words within double quotes, for example:
>>
>> ... contains(jobdescription,'"Benefits clear"')
>>
>> This will return the phrase "Benefits clear" in the FT-enable column
>> jobdescription, if this phrase exists in this column. You might find the
>> following KB article helpful too: 246800 (Q246800) "INF: Correctly
>> Parsing
>> Quotation Marks in FTS Queries" at
>>
http://support.microsoft.com//default.aspx?scid=kb;EN-US;246800 >
> That makes sense.
>
> But what I want to be able to do is allow the user to put in -Benefits
> Clear Payroll- in the text field and look for articles with Benefits and
> Clear and Payroll in them, as well as deal with someone putting in
> Benefits and Clear and Payroll.
>
> I assume I would have to replace the blanks with "and" to make it work.
>
> I played with the article you suggested and it shows how to surround "and
> not" with double quotes as well as "or not". I am confused as to why you
> would surround "and" and "or" with quotes - 'benefits and Clear' work.
>
> Is there a regular expression that says to replace the blank with "and"
> only if the 2 words are not (and,or,near) ?
I found a way to make this sort of work (but not very elegant).
testLabel.text = "sales near marketing and database"
testLabel.text = Regex.Replace(testLabel.text, "( )", " and ")
testLabel.text = Regex.Replace(testLabel.text," and and "," ")
testLabel.text = Regex.Replace(testLabel.text,"and or and","or")
testLabel.text = Regex.Replace(testLabel.text,"and near and","near")
This will change all blanks to " and ". It will then look for and, or and
near and put them back as they would be surrounded by " and ".
My problem is phrases.
If I have something like:
sales "marketing franchise" dealer
I would get:
sales and "marketing and franchise" and dealer
Is there a way of telling the regex to ignore changes inside quotes?
Thanks,
Tom
[quoted text, click to view] >
> Thanks,
>
> Tom
>>
>> Regards,
>> John
>> --
>> SQL Full Text Search Blog
>>
http://spaces.msn.com/members/jtkane/ >>
>>
>>
>> "tshad" <tfs@dslextreme.com> wrote in message
>> news:#R9kgF8QFHA.2132@TK2MSFTNGP14.phx.gbl...
>>> Why do I get the error:
>>>
>>> System.Data.SqlClient.SqlException: Syntax error occurred near 'clerk'.
>>> Expected ''''' in search condition 'Benefits clerk'.
>>>
>>> I get this from:
>>>
>>> ... contains(jobdescription,'Benefits clear')
>>>
>>> Thanks,
>>>
>>> Tom
>>>
>>>
>>
>>
>
>