Search QueryProvider problems
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
Search QueryProvider problems

 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development
Author Message
Abro Gaticus
Guest





Posted: Thu Jan 20, 2005 6:45 am    Post subject: Search QueryProvider problems Reply with quote

I've seen this problem addressed several times in the archives but I
failed to find a solution. I'm hoping someone can shed new light.

the following exception is thrown when trying to instantiate a
QueryProvider object:

Object reference not set to an instance of an object.
at Microsoft.SharePoint.Portal.Search.c.c() at
Microsoft.SharePoint.Portal.Search.c..ctor(String A_0) at
Microsoft.SharePoint.Portal.Search.d.e(String A_0) at
Microsoft.SharePoint.Portal.Search.QueryProvider..ctor(String
strSiteName) at simpleWebPart.WebPart1.createSearch()

Code Snippet:

protected string createSearch() {

String msg = "";

try {

TopologyManager topology = new TopologyManager();
PortalSite portal = topology.PortalSites[new
Uri("http://testServer")];
PortalContext context = PortalApplication.GetContext(portal);

// test msg to show HttpContex object and PortalContex obj are valid
msg += "Context (server name): " + Context.Server.MachineName +
"<br>";
msg += "Search app name: " + context.SearchApplicationName;

QueryProvider qp = new QueryProvider(context.SearchApplicationName);
}
catch (InvalidOperationException ex) {
msg += "<br>" + ex.Source + "<br>" + ex.Message + "<br>";
msg += ex.StackTrace;
}
catch (Exception ex) {
msg += "<br>" + ex.Source + "<br>" + ex.Message + "<br>";
msg += ex.StackTrace;
}

return msg;
}

I am essentially following the procedure outlined in Microsoft's
article
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odc_sp2003_ta/html/office_sharepointportalserversearchbox.asp

printing out msg shows:

a) the HttpContext object is not null and properties are set to actual
values.
b) the PortalContext ojbect is not null and was properly instantiated
and the SearchApplicationName property contains a guid.
c) the above referenced error message thrown within the QueryProvider
constructor.

I am trying to execute the above code inside a webpart located on a
WebPartPage stored within a document library on a portal top level
site. I have not found any documentation regarding when or where a
QueryProvider object can or cannot be instantiated.
Any insight would be greatly appreciated.

Thanks.

-Abro
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Portal Server Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB