0

我正在尝试使用以下代码查询共享点搜索

    protected ResultTable Search(String query, SPWeb currentWeb)
    {
        ResultTable rt = null;

        try
        {
            FullTextSqlQuery q = GetFullTextSqlQuery(currentWeb);

            q.QueryText = query;

            q.RowLimit = int.MaxValue;
            rt = ((ResultTableCollection)q.Execute())[ResultType.RelevantResults];
            //q.Dispose();

        }
        catch (Exception ex)
        {
            rt = null;
            Logging.LogException(ex);
        }

        return rt;
    }

    /// <summary>
    /// Create base FullTextSqlQuery
    /// </summary>
    /// <returns>FullTextSqlQuery</returns>
    protected static FullTextSqlQuery GetFullTextSqlQuery(SPWeb currentWeb)
    {
        FullTextSqlQuery q = new FullTextSqlQuery(currentWeb.Site);

        q.Culture = new CultureInfo(1033);

        q.EnableStemming = false;
        q.TrimDuplicates = true;

        if (SPSecurity.AuthenticationMode != System.Web.Configuration.AuthenticationMode.Windows)
        {
            q.AuthenticationType = QueryAuthenticationType.PluggableAuthenticatedQuery;
        }
        else
        {
            q.AuthenticationType = QueryAuthenticationType.NtAuthenticatedQuery;
        }

        q.RowLimit = 200;

        q.StartRow = 0;
        q.IgnoreAllNoiseQuery = false;
        q.ResultTypes = ResultType.RelevantResults;

        return q;

    }

不管我做什么,我都会得到这个异常:HRESULT 的异常:0x80040E01

23-07-2012 14:53:45 Documenten 搜索 System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail] 来自 HRESULT 的异常:0x80040E01

服务器堆栈跟踪:在 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) 在 System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)。 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)。 ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage 消息)

在 [0] 处重新引发异常:在 Microsoft.Office 的 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) 处的 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)。 Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.<> c_DisplayClass4.b _3(ISearchServiceApplication serviceApplication) 在 Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy上的 Server.Search.Query.ISearchQueryServiceApplication.Execute(QueryProperties 属性) 。 DoSpLoadBalancedUriWsOp[T](WebServiceBackedOperation1 webServiceCall, Int32 timeoutInMilliseconds, Int32 wcfTimeoutInMilliseconds, String operationName) at Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.DoWebServiceBackedOperation[T](String operationName, Int32 timeoutInMilliseconds, Int32 wcfTimeoutInMilliseconds, WebServiceBackedOperation1 webServiceCall) 在 Microsoft.Office.Server.Search.Administration.SearchServiceApplicationProxy.Execute(QueryProperties 属性) 在 Microsoft.Office.Server.Search.Query.Query.Execute() 在 Rapportages.RapportageDocumenten.RapportageDocumenten.Search(字符串查询,SPWeb当前网络)

我阅读了我应该减少行限制的建议,但即使行限制低至 20,我也会遇到此异常。

4

1 回答 1

0

将 fulltextsqlquery 放入 using 解决了该问题。不要问我为什么。

                   using (FullTextSqlQuery q = GetFullTextSqlQuery(web))
                    {
                        q.QueryText = sqlQuery.ToString();
                        rt = ((ResultTableCollection)q.Execute())[ResultType.RelevantResults];
                        Logging.LogMessage(rt.RowCount.ToString());
                    }
于 2012-08-03T11:45:01.177 回答