문제

I'm writing a FullTextSqlQuery and would like to return all available columns in the result set.

When I specify the columns, e.g. SELECT Title FROM scope() WHERE ("scope" = 'All Sites'), the query works fine.

When I try to select all columns, e.g. SELECT * FROM scope() WHERE ("scope" = 'All Sites'), a QueryMalformedException is raised.

The code for the query execution is:

var sqlQuery = new FullTextSqlQuery(SPContext.Current.Site)
{
    ResultTypes = ResultType.RelevantResults,
    QueryText = searchQuery
};
var collectionOfResults = sqlQuery.Execute();

Is it possible to retrieve all available columns, or is there a workaround?

도움이 되었습니까?

해결책

AFAIK you have to specifically mention the columns you want.

In the SQL query, you are allowed to use the asterisk (*) to specify that all columns in a table are to be returned. However, no defined and fixed set of properties applies to all documents. For this reason, the SQL asterisk is not permitted in the [columns] setting.

http://msdn.microsoft.com/en-us/library/ms569178.aspx

다른 팁

FullTextSqlQuery uses a SQL-like syntax, but is not actually SQL. The query statement is parsed internally by SharePoint and used to query the flat index files generated by the crawler on the file system, as well as to generate real SQL queries which may be executed on the search database.

You therefore cannot use '*', and are limited to specifying only managed properties in your select statement. These properties can be defined in your SSP settings.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top