Where is the correct place to change the query before query is executed in a custom CoreResults webpart.


//QueryManager.UserQuery = query.ToString();
runtime.KeywordQueryObject.QueryText = query.ToString();

AddSortOrder in CoreResultsDatasourceView does not seem to work.

| improve this question | | | | |

I've succesfully modified my query (but I'm using Fast Search, don't know how much it does change) overriding SetPropertiesOnQdra() in the extended CoreResultsDatasourceView inner class.

| improve this answer | | | | |

I ended up overriding GetXpathNavigator in my custom CoreResultsWebpart. This event fires in a late stage, causing the query change not to be overwritten. First I tried to override AddSortOrder in my View, the changes to the query was then lost. Changing sorting worked in AddSortOrder though.

The code I added to GetXPathNavigator was:

QueryManager.UserQuery = query.ToString();

As mamoo noted overriding SetPropertiesOnQdra() will probably work as well. Allthough I have not tested, but will do at work on Monday.

Som offical guidance/best practices on SharePoint Search from Microsoft would really be appreciated.

| improve this answer | | | | |

This may be helpful to you.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.