I'm trying to perform searches programmatically for the backend of a web part, but all the results are from the default zone. I want them to come from the same zone as the SPSite object I'm using as a context for the search, but the UrlZone property of KeywordQuery is read only.

Is it possible to change the UrlZone of a KeywordQuery?


Apparently I managed to miss something in my own code. KeywordQuery seems to use the urlzone of whatever it's given in the constructor. I grabbed the current serviceContext which did not contain a proper zone declaration so it used the default zone. Switching to the current SPSite object (which did have the correct zone) solved the issue.

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.