views:

137

answers:

2

Setting up Microsoft Search Server 2008 and going to expose the search functionality to DotNetNuke via the webservice (Search.asmx) but we want to record the clicks in order to tailor search results by creating new Best Bets, etc. The webservice has a method "RecordClick" which is supposed to provide that functionality... problem is I can't find documentation for it... the best I found is this: http://msdn.microsoft.com/en-us/library/dd905815.aspx

I'm going to try hand-building a fake request using the info from that link above but if anybody else has had experience with this and can provide more useful information I'd greatly appreciate it.

A: 

After a lot of research on the topic I finally came across some Microsoft API documentation that flat out said "for internal use only". I challenged that and attempted to do it anyway; I used Fiddler to break out the request and figure out what it was doing, what each piece of data meant to the request, etc, and then tried duplicating it.

I learned the following:


REQUEST BREAK DOWN


attributes:

a = false in both test queries d = false in both test queries g = site guid h = 0 in both queries m = hex string followed by a comma and a number... not sure what it is yet; n = varying number; 99 on first, 131 on second... possibly number or results? 0 on a third test so probably not number results; later research shows this is the number of "high confidence results" p = the site title (name of the search site) q = the query we used t = time of the search or click in UTC u = the url clicked from (maybe always just use "http://[YOURSITE]/results.aspx"?) v = currently a 0 in both test queries x = possibly best bet? it shows 0 on the non-best-bet and 1 on the best bet query

inner xml (these are inner xml elements to the ... tag) f = false in both queries r = 1 in both queries s = the scope used (All Sites, for example) c = link actually clicked (ex., http://%5Bsomelink%5D) y = best bet title if you clicked a best bet (ie., MyBestBet)

Long story short... since I couldn't figure out how to generate the "m" attribute and all attempts to post back to the server didn't record an actual click I determined that "m" is definitely a required field. I have no idea how that is generated but it is specific to the search instance not to each url. Since MS specifically says not to use it I guess they really meant it.

Fooberichu
A: 

The XML argument of RecordClick is a serialized QueryInfo object (Microsoft.Office.Server.Search.Query.QueryInfo) which is a public sealed class. You can use reflector to investigate the class further.

From what I've gathered so far the RecordClick method is called from Microsoft.Office.Server.Search.WebControls.SearchResultsBaseWebPart, which is used to render search results.

When the page rendered by SearchResultsBaseWebPart is loaded a function is registered for the onlick event of all HTML link elements whos ID matches a RegExp filter. The page's unload event is also registered to send a soap request to the search web service RecordClick method.

You should be able to work out the remaining magic by using Reflector and a Sharepoint search site.

I hope this helps.

Magnus Törnvall