Package com.esri.gpt.catalog.search

Examples of com.esri.gpt.catalog.search.SearchCriteria


      String tmp = request.getPathInfo().replaceAll("^/", "");
      id = URLDecoder.decode(tmp,"UTF-8");
    }
   
    // create search dao
    SearchCriteria criteria = new SearchCriteria();
    SearchResult result = new SearchResult();
    ASearchEngine dao =
      rid.length()==0?
      SearchEngineFactory.createSearchEngine(criteria, result, context,
          msgBroker):
View Full Code Here


    if("".equals(harvestID)) {
      engine = super.getSearchDao();
    } else {
   
      engine = SearchEngineFactory.createSearchEngine(
          new SearchCriteria(), new SearchResult(),
          this.extractRequestContext(), harvestID,
          this.getContextBroker().extractMessageBroker());
    }
    response = Val.chkStr(engine.getMetadataUrl(uuid));
   
View Full Code Here

  } catch (Exception e) {
    LOG.log(Level.WARNING, "Could not get rid during creating rest urls", e);
  }
 
  SearchCriteria criteria = this.getSearchCriteria();
  RequestContext context =  this.getContextBroker().extractRequestContext();
  HttpServletRequest request = this.getContextBroker().extractHttpServletRequest();
 
  // If request is coming from search page then we can parse the url and
  // come up with the url
View Full Code Here

  // determine the rids
  StringSet rids = this.getRids(request);

  // Get the criteria
  SearchCriteria criteria = this.toSearchCriteria(request, context, query);

  SearchResultRecords searchResultRecords = new SearchResultRecords();
  try {

    // make the search context
View Full Code Here

          MessageBroker messageBroker,
          RestQuery query) throws SearchException {

    // make the search engine
    ASearchEngine engine = null;
    SearchCriteria criteria = this.toSearchCriteria(request, context, query);
    SearchResult result = new SearchResult();
    String rid = Val.chkStr(query.getRepositoryId());
    RestQueryServlet.ResponseFormat format = getResponseFormat(request, query);

    boolean isJavascriptEnabled =
View Full Code Here

   * @param query the pre-populated rest query
   * @return the search criteria object
   */
  protected SearchCriteria toSearchCriteria(HttpServletRequest request,
          RequestContext context, RestQuery query) {
    SearchCriteria criteria = new SearchCriteria();
    RestQueryParser parser = new RestQueryParser(request, context, new RestQuery());

    // keyword filter
    String sKeyword = Val.chkStr(parser.getRequestParameter("searchText"));
    if (sKeyword.length() > 0) {
      SearchFilterKeyword fKeyword = new SearchFilterKeyword();
      fKeyword.setSearchText(sKeyword);
      criteria.setSearchFilterKeyword(fKeyword);
    }

    // spatial filter
    SpatialClause bbox = parser.extractSpatialClause("bbox", "spatialRel", "geometry");
    if (bbox != null) {
      SearchFilterSpatial fSpatial = new SearchFilterSpatial();
      fSpatial.setSelectedEnvelope(bbox.getBoundingEnvelope());
      if (bbox instanceof SpatialClause.GeometryIsWithin) {
        fSpatial.setSelectedBounds(ISearchFilterSpatialObj.OptionsBounds.dataWithinExtent.name());
      } else {
        fSpatial.setSelectedBounds(ISearchFilterSpatialObj.OptionsBounds.useGeogExtent.name());
      }
      criteria.setSearchFilterSpatial(fSpatial);
    }

    // content type filter
    String sContentType = Val.chkStr(parser.getRequestParameter("contentType"));
    try {
      if (sContentType.length() > 0) {
        SearchFilterContentTypes fContentTypes = new SearchFilterContentTypes();
        fContentTypes.setSelectedContentType(
                SearchEngineCSW.AimsContentTypes.valueOf(sContentType).name());
        criteria.setSearchFilterContentTypes(fContentTypes);
      }
    } catch (IllegalArgumentException ex) {
      // if invalid content type simply do not create filter
    }

    // data category filter
    String delimitedThemes = Val.chkStr(parser.getRequestParameter("dataCategory"));
    String[] themes = Val.tokenize(delimitedThemes, ",");
    if (themes != null && themes.length > 0) {
      ArrayList<String> alThemes = new ArrayList<String>();
      for (String theme : themes) {
        alThemes.add(theme);
      }
      SearchFilterThemeTypes fThemes = new SearchFilterThemeTypes();
      fThemes.setSelectedThemes(alThemes);
      criteria.setSearchFilterThemes(fThemes);
    }

    // temporal filter
    String sAfter = Val.chkStr(parser.getRequestParameter("after"));
    String sBefore = Val.chkStr(parser.getRequestParameter("before"));
    if ((sAfter.length() > 0) || (sBefore.length() > 0)) {
      SearchFilterTemporal fTemporal = new SearchFilterTemporal();
      fTemporal.setDateModifiedFrom(sAfter);
      fTemporal.setDateModifiedTo(sBefore);
      fTemporal.setSelectedModifiedDateOption(
              SearchFilterTemporal.SelectedTimePeriod.beforeAndOrAfterPeriod.name());
      criteria.setSearchFilterTemporal(fTemporal);
    }

    // pagination filter
    SearchFilterPagination fPagination = new SearchFilterPagination();
    fPagination.setStartPostion(query.getFilter().getStartRecord());
    fPagination.setRecordsPerPage(query.getFilter().getMaxRecords());
    int startRecord = query.getFilter().getStartRecord();
    int maxRecords = query.getFilter().getMaxRecords();
    double page = (((double) startRecord) / ((double) maxRecords));
    fPagination.setCurrentPage((new Double(Math.ceil(page))).intValue());
    criteria.setSearchFilterPageCursor(fPagination);

    // sort filter
    String sOrderBy = Val.chkStr(parser.getRequestParameter("orderBy"));
    try {
      if (sOrderBy.length() > 0) {
        SearchFilterSort fSort = new SearchFilterSort();
        fSort.setSelectedSort(SearchFilterSort.OptionsSort.valueOf(sOrderBy).name());
        criteria.setSearchFilterSort(fSort);
      }
    } catch (IllegalArgumentException ex) {
      // if invalid content type simply do not create filter
    }

    // Distributed search
    String rid = parser.getRequestParameter("rid");
    SearchFilterHarvestSites harvestSites = new SearchFilterHarvestSites();
    harvestSites.setSelectedHarvestSiteId(rid);
    SearchFiltersList filterList = new SearchFiltersList();
    filterList.add(harvestSites);
    criteria.setMiscelleniousFilters(filterList);
    return criteria;
  }
View Full Code Here

       
    String criteria = savedCriteria.getCriteria();
    try {
      InputStream inputStream = new ByteArrayInputStream(criteria.getBytes());
      Document doc = XMLUtils.newDocument(new InputSource(inputStream));
      SearchCriteria searchCriteria = new SearchCriteria(doc);
      MessageBroker messageBroker =
        new FacesContextBroker(request,response).extractMessageBroker();
      RestUrlBuilder builder = RestUrlBuilder.newBuilder(context,request,
          messageBroker);
      String id = SearchEngineLocal.ID;
      for(ISearchFilter filter : searchCriteria.getMiscelleniousFilters()) {
        if(filter instanceof SearchFilterHarvestSites) {
          SearchFilterHarvestSites hFilter = (SearchFilterHarvestSites) filter;
          id = hFilter.getSelectedHarvestSiteId();
        }
      }
View Full Code Here

TOP

Related Classes of com.esri.gpt.catalog.search.SearchCriteria

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.