I have a federated location via OpenSearch 1.0/1.1 that I want to search programmatically. Can I programmatically make my own search box where I can post the search word as a variable and a date variable from a eg. jQuery datepicker and process the data to my federated location?


Yes you can use SearchServiceApplicationProxy and QueryManager

SearchServiceApplicationProxy proxy = (SearchServiceApplicationProxy)SearchServiceApplicationProxy.GetProxy
LocationConfiguration[] locationConfigs;
LocationConfiguration locationConfig = null;
locationConfigs = proxy.GetLocationConfigurations(out lastupdate, out crawl);
Location location;
LocationList locationList = new LocationList();
QueryManager queryManager = new QueryManager();
foreach (LocationConfiguration locConfig in locationConfigs)
    if (locConfig.InternalName.Equals("LocalSearchIndex"))
         locationConfig = locConfig;
location = new Location(locationConfig.InternalName, proxy);
location.UserQuery = queryText;
XmlDocument xDoc = queryManager.GetResults(locationList);
DataSet resultSet = new DataSet();
resultSet.ReadXml(new XmlNodeReader(xDoc));

Check this msdn

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.