/**
  * Read controller from the request.
  *
  * @return the search controller
  */
 private SearchController readController() {
   FacesContextBroker broker = new FacesContextBroker();
   @SuppressWarnings("unused")
   FacesContext fc = broker.getFacesContext();
   // intentionally not used
   SearchController controller =
       (SearchController) broker.resolveManagedBean(JSFBEAN_SEARCH_CONTROLLER);
   controller.setSearchCriteria(this.getCriteria());
   return controller;
 }
 /**
  * Write.
  *
  * @param records the records
  * @see
  *     com.esri.gpt.control.georss.FeedWriter#write(com.esri.gpt.catalog.search.SearchResultRecords)
  */
 @Override
 public void write(IFeedRecords records) {
   SearchController controller = this.readController();
   controller.getSearchResult().setRecords(new SearchResultRecords(records));
   controller.setWasSearched(true);
   try {
     showResults();
   } catch (Exception e) {
     LOG.log(Level.WARNING, "Error while showing results", e);
   }
 }
  /**
   * Write.
   *
   * @param result the result
   */
  public void write(SearchResult result) {

    SearchController controller = this.readController();
    controller.setSearchCriteria(this.getCriteria());
    this.getCriteria().getSearchFilterPageCursor().setTotalRecordCount(result.getMaxQueryHits());

    controller.setSearchResult(result);
    controller.setWasSearched(true);
    try {
      showResults();
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }