最初,我认为这3个人做的事情或多或少是一样的,只是符号不同。直到最近,当我注意到KeyWordQuery/FullTextQuerySearch和Web服务查询的结果之间确实存在很大的差异时。
我使用了KeywordQuery和FullText方法来搜索带有值的customColumn XYZ的值(ASDSADA-21312ASD-ASDASD):-
当我运行这个查询时:- FullTextSqlQuery:-
FullTextSqlQuery myQuery = new FullTextSqlQuery(site);
{
// Construct query text
String queryText = "Select title, path, author, isdocument from scope() where freetext('ASDSADA-21312ASD-ASDASD') ";
myQuery.QueryText = queryText;
myQuery.ResultTypes = ResultType.RelevantResults;
};
// execute the query and load the results into a datatable
ResultTableCollection queryResults = myQuery.Execute();
ResultTable resultTable = queryResults[ResultType.RelevantResults];
// Load table with results
DataTable queryDataTable = new DataTable();
queryDataTable.Load(resultTable, LoadOption.OverwriteChanges);我得到了以下表示文档的结果。
* Title: TestPDF
* path: http://SharepointServer/Shared Documents/Forms/DispForm.aspx?ID=94
* author: null
* isDocument: false 请注意以上结果的Path和isDocument字段。
Web服务方法
然后我尝试了一种Web服务查询方法。我使用了http://sharepointsearchserv.codeplex.com/上提供的Sharepoint搜索服务工具,并运行了相同的查询,即从scope() where freetext('ASDSADA-21312ASD-ASDASD')中选择标题、路径、作者、isdocument。这次我得到了以下结果:
* Title: TestPDF
* path: http://SharepointServer/Shared Documents/TestPDF.pdf
* author: null
* isDocument: true 再次注意路径。虽然方法2的搜索结果很有用,因为它们准确地提供了文件路径,但我似乎不能理解为什么方法1没有给出相同的结果?
为什么两个结果之间会有差异?
发布于 2013-05-14 05:52:49
第一项是列表项,而不是文档本身。文档库本质上就是另一个专门用来保存文档的列表。列表项可能有一些文档中没有保存的额外元数据,等等。第二个结果是实际的文档,因此将为它设置"isDocument“标志。
至少这是我的理论。
https://stackoverflow.com/questions/2949064
复制相似问题