搜索文档时遇到的问题,同这个老外遇到的问题一样

Thread
Author

Catastrophic failure when searching subsites
Microsoft.SharePoint.SPException: Catastrophic failure --->
System.Runtime.InteropServices.COMException

I am trying to write a web part that will return search results across all
subsites within a site and have run into a strange error. I found questions
about this error already posted in several newsgroups - but no solution :-(

1)
I first get the current (root) web using the following line:
SPWeb oRoot =SPControl.GetContextWeb(this.Context).Site.RootWeb;

2)
I can then search the documents and lists by using the following lines:
SPSearchResultCollection oRootDocResults =
oRoot.SearchDocuments(SearchString);
--> this works ok!

3)
I now need to get all of the subsites that the current user has permissions
to view and then I loop through all of these sites and call the
 method. This is where the problem occurs.
SPWebCollection subSites = oRoot.GetSubwebsForCurrentUser();
SPSearchResultCollection oDocResults;
for (int i=0;i<subSites.Count;i++)
{
oDocResults = subSites[i].SearchDocuments(SearchString);
}

When the  method is called I get the following error:

Microsoft.SharePoint.SPException: Catastrophic failure --->
System.Runtime.InteropServices.COMException

I am at a loss as to why this is occuring. Any ideas or suggestions?
I am really in a bind and need to get cross-site search running.
Thanks in advance!
Martin



Report this thread to moderator Post Follow-up to this message
Old Post
Martin
01-25-05 02:03 AM


Re: Catastrophic failure when searching subsites
Hi Martin,

I'm just guessing here, but what if you tried this:

SPWebCollection subSites = oRoot.GetSubwebsForCurrentUser();
SPSearchResultCollection oDocResults;

foreach (SPWeb searchWeb in subSites)
{
oDocResults = searchWeb.SearchDocuments(SearchString);
}

Does that help?

Are you getting the error the first time trhough the loop, or the second?
Keep in mind that the oDocResults is redefined each time through the loop;
i.e. the results of the search are not added to the SPSearchResultCollection
but replace them.


--
_____________
Jim Duncan
Collutions, Inc.

"Martin" <martinREMOVE@advis.ch> wrote in message
news:%23qMWMXz$EHA.3908@TK2MSFTNGP12.phx.gbl...



Report this thread to moderator Post Follow-up to this message
Old Post
Jim Duncan
01-25-05 02:03 AM


Re: Catastrophic failure when searching subsites
Hi Jim,

Thank you but no, that doesn't help.
The code I posted was from a first quick and dirty trial.
What I really want to do is in VB and looks like this:

Private Sub searchWeb(ByVal web As SPWeb, ByRef output As
System.Web.UI.HtmlTextWriter)
Dim subWeb As SPWeb
Dim src As SPSearchResultCollection = web.SearchDocuments(SearchString)
For Each sr As SPSearchResult In src
'Render out the search results...
Next
Dim subWebs As SPWebCollection = web.GetSubwebsForCurrentUser()
For Each subWeb In subWebs
searchWeb(subWeb, output)
Next
End Sub

This works fine for the root web. But in the recursive iterations, the
web.SearchDocuments(SearchString) throws the Catastrophic Failure
exception...

Any other ideas would be greatly appretiated!

Martin


"Jim Duncan" <CollutionsInc@community.nospam> wrote in message
news:u1IAOC0$EHA.3368@TK2MSFTNGP15.phx.gbl...

转载于:https://www.cnblogs.com/huangfh/archive/2005/02/01/100303.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值