PlawCoder
asked on
How can I properly query SystemIndex when there are spaces?
Hi!
I have a CLR function that I reference from SQL to carry out full-text searches. The problem I'm having is that the path where the documents reside contains a space i.e. "C:\My Documents\Information". When I place the call I receive no hits. Yet, if I carry out the sample call with a path that contains no spaces i.e. "C:\MyDocuments\Informatio n" I receive a slew of responses.
My query to SystemIndex is formatted like so:
Does anybody know what I can do to get around this issue. All the examples I find online refer to a path that have no spaces, but client setups vary across the board and we can't enforce that as a rule.
Please help.
I have a CLR function that I reference from SQL to carry out full-text searches. The problem I'm having is that the path where the documents reside contains a space i.e. "C:\My Documents\Information". When I place the call I receive no hits. Yet, if I carry out the sample call with a path that contains no spaces i.e. "C:\MyDocuments\Informatio
My query to SystemIndex is formatted like so:
"SELECT System.FileName, System.ItemPathDisplay, System.DateModified FROM SystemIndex WHERE SCOPE = '" + Scope + "' AND CONTAINS('" + Contains + "')"
Does anybody know what I can do to get around this issue. All the examples I find online refer to a path that have no spaces, but client setups vary across the board and we can't enforce that as a rule.
Please help.
AND CONTAINS('" + Contains.Replace(" ", "") + "')"
ASKER
The issue here is the SCOPE portion of the query. The path is the one that contains spaces.
The solution is to replace space with an empty string . . . you can do that on the scope instead.
ASKER
Thanks Kyle.
But I can't effectively replace "C:\My Documents\Information" with "C:\MyDocuments\Informatio n". That would yield an entirely different path, which doesn't even exist in my directory.
Perhaps I'm not understanding your statement.
But I can't effectively replace "C:\My Documents\Information" with "C:\MyDocuments\Informatio
Perhaps I'm not understanding your statement.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.