Question

I want to get all items of a custom content type while using fast search. I want to use keyword search but i also could use fql. Can somebody show me how to do this in code? I'm getting restults for standard content types when using something like Querytest = "contenttype:document".

[Update] The problem was that i only started a crawl on the content source for the Fast Search Query Server not for the connector.

Thanks for the answers.

Was it helpful?

Solution

I'm not 100% on setting up FAST, but in Enterprise Search, you have to modify the crawled property ows_contenttype to include the values in the search index, and the managed property ContentType should return the values, and allow you to search by it.

OTHER TIPS

Try the following:

KeywordQuery keywordQuery = new KeywordQuery(SPContext.Current.Site);

keywordQuery.QueryText = "ContentType:Document";
keywordQuery.ResultsProvider = SearchProvider.Default;
keywordQuery.ResultTypes = ResultType.RelevantResults;
ResultTableCollection results = keywordQuery.Execute();
 
ResultTable resultsTable = results[ResultType.RelevantResults];
DataTable dataTable = new DataTable();
dataTable.TableName = "Results";
dataTable.Load(resultsTable, LoadOption.OverwriteChanges);

You can then access the results from within the DataTable returned.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top