pnp / PnP-Tools

Scripts and tools for Office 365 and SharePoint - More for IT Pro's

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SearchQueryTool: Get Ranklog XML through RestAPI

Phil1108 opened this issue · comments

Is it possible to retrieve the results which are shown when clicking on the "Show rank details" button in the Search Query Tool via the Rest API?
It should be a XML as visible in the Window which opens then.

The Documentation only provides few information about the "generateblockranklog=true" parameter which one has to add to GET Requests but the return value does not contain the RankLog.xml information.

The resulting File should look like this:

<rank_log version='15.0.0000.1000' id='8F6FD0BC-06F9-43CF-BBAB-08C377E083F4' instance_id='IndexComponent1-642a90e6-1d65-49aa-9974-6604c00e4026-SPff6e5284937d.I.0.0' corr_id='E416629F-D2B9-C092-232B-CC89CC545FC8'> <query_term term='content:test'> </query_term> <bucketed_static_feature name='DetectedLanguageRanking' property_name='DetectedLanguageRanking' raw_value_transform='equal' used_default='1' property_value_found='1' property_value='9' raw_value_in='0' raw_value='0' raw_value_transformed='0' hidden_nodes_adds='-0.110721'/> <property_name value='AnchortextCompleteQueryProperty'> </property_name> .............

You can ask to retrieve the managed property rankdetail as part of SelectProperties. I think you need all of these for it to work:

RankDetail,Title,Path,Language,WorkID

And you have to parse the XML yourself to figure it out. You can look at the source code for the query tool as reference. It's more or less a reverse engineering from the SP on-prem code with some changes.