I'm attempting search a custom column from a document library using the search
web service (search.asmx) programmatically and I'm not really sure what the
problem is.
I have two custom columns on a doc lib, let's call them "Contains Data"
(yes/no), and "My Data" (mutli-line text). Both fields have been picked up by
the crawler. I've also created to map properties to map the doclib column
"Contains Data" to "containsData" and "My Data" to "myData".
Both mapped properties appear when using the SharePoint Search Service Tool.
On to the problem...
When executing this to weed out the results that has containsData=1:
SELECT Title, Author,Description, FileExtension, Path, keywords ,Size,Rank,
containsData, ContentType,
ContentSource,Created,CreatedBy,DocSignature,IsDocument FROM portal..scope()
Where FREETEXT(DefaultProperties, 'stuff') AND Contains(containsData,'"1"')
ORDER BY "Rank" DESC
it works just fine and I get back results.
When executing this to pull down the contents of myData:
SELECT Title, Author,Description, FileExtension, Path, keywords ,Size,Rank,
containsData, myData, ContentType,
ContentSource,Created,CreatedBy,DocSignature,IsDocument FROM portal..scope()
Where FREETEXT(DefaultProperties, 'stuff') AND Contains(containsData,'"1"')
ORDER BY "Rank" DESC
I keep getting a
"Microsoft.Office.Server.Search.Query.InvalidPropertyException"
error.
Further more, from the 12 logs....
06/06/2010 17:27:00.25 w3wp.exe (0x0DA4) 0x1074 Search
Server Common MS Search Administration 0 High Log Query:
Property doesn't exist or is used in a manner inconsistent with schema settings.
More Information: Column does not exist.
06/06/2010 17:27:00.25 w3wp.exe (0x0DA4) 0x1074 Search
Server Common MS Search Query 7hte High Exception
caught in QueryService.Query method. Exception message: Property doesn't exist
or is used in a manner inconsistent with schema settings.. Stack: at
Microsoft.Office.Server.Search.Query.FullTextSqlQuery.Execute() at
Microsoft.Office.Server.Search.Query.QueryService.DoQuery(Boolean queryMethod,
String queryXml, String& domain, String& queryId, Int32& startAt, Boolean&
fStandardResults) at
Microsoft.Office.Server.Search.Query.QueryService.Query(String queryXml).
So basically, I'm puzzled that is says that the column doesn't exist, yet I can
see that it's managed and mapped using the Search Tool. For those not familiar
with the tool, it basically calls the web service and retrieves the managed
properties listing.
To make matters a bit more interesting, there is another search tool on codeplex
called Search Coder that lets you use the same sql statement using the
SharePoint object model and by using the web service. When using this tool with
the web service, it returns the same error (expected). When using this tool
against the object model, it works!
So I guess the big question is, whats different between the OM and the search
web service and how to get around this problem (other than using the OM)?