Friday, March 30, 2012

question about searching with indexing service

Trying to limit the search using scope but I am having some problems. When I search with just FROM SCOPE(), the search works just fine. But when I try and do FROM SCOPE ('"/mydirectory"'), i get the following error.Compiler Error Message:BC30451: Name 'mydirectory' is not declared.

strSearch = "SELECT RANK, FileName, Path, VPath, Characterization, DocTitle, Size, DocAppName FROM SCOPE('"/mydirectory"') WHERE FREETEXT('" & trim(lblsearchstr.text) & "') ORDER BY RANK DESC"


anyone have a solution. all resources i can find seem to set the scope in the same way. also can not find any articles that mention such an error.|||

figured it out. need two double quotes.

SCOPE('""/mydirectory""')

and if you use a variable you need 3 double quotes

SCOPE('""" & myVar & """')

|||

gww:

figured it out. need two double quotes.

SCOPE('""/mydirectory""')

and if you use a variable you need 3 double quotes

SCOPE('""" & myVar & """')

I just tried this (I put up a similar question a few days ago in 'Other Data Sources,' since I didn't really think of Indexing Service as SQL Server per se), and while it doesn't generate any exceptions, the search no longer returns results properly (in fact, it doesn't return any).

Thoughts?|||Hoping someone else sees this, because I'm completely out of ideas. I've tried:

FROM SCOPE('DEEP TRAVERSAL OF ("policy")') End of statement expected
FROM SCOPE('("policy")') End of statement expected
FROM SCOPE('DEEP TRAVERSAL OF ("C:\Inetpub\wwwroot\policy\")') Character constant must contain exactly one character
FROM SCOPE('DEEP TRAVERSAL OF ('C:\Inetpub\wwwroot\policy\')') Incorrect syntax near '''. Expected URL. SQLSTATE=42000
FROM SCOPE("/policy") Name 'policy' is not declared.
FROM SCOPE('DEEP TRAVERSAL OF "/policy"') Name 'policy' is not declared.

in addition to the method recommended above.

No comments:

Post a Comment