Ejemplo n.º 1
0
  @Override
  public ArrayList<DataSetInfo> getDataSetsBySearch(
      int start, int length, SearchCriteria searchCriteria) {

    ArrayList<String> filteredDatasetIds = new ArrayList<String>();
    ArrayList<DataSetInfo> filteredDataSets = new ArrayList<DataSetInfo>();
    if (searchCriteria.getTags().size() > 0) {
      for (DataSetDescription dataSetDescription : DataSets.dataSetDescriptions.values()) {
        if (dataSetDescription.getTags().containsAll(searchCriteria.getTags())) {
          filteredDatasetIds.add(dataSetDescription.getDataSetId());
        }
      }
    }
    if (searchCriteria.getQuery().length() > 0) {
      ArrayList<String> datasetIds = indexServiceImpl.SearchIndex(searchCriteria.getQuery());
      System.out.println("datasetIds returned from search: " + datasetIds.size());
      filteredDatasetIds.addAll(datasetIds);
    }

    for (String dataSetid : filteredDatasetIds) {
      DataSetInfo dataset = DataSets.dataSetsInfos.get(dataSetid);
      System.out.println("total datasetInfos: " + DataSets.dataSetsInfos.keySet());

      filteredDataSets.add(dataset);
    }
    System.out.println("returned" + filteredDatasetIds.size());

    return filteredDataSets;
  }
Ejemplo n.º 2
0
  @Override
  public void setDescription(String id, DataSetDescription description) {

    DataSets.dataSetDescriptions.put(id, description);
    ArrayList<String> tags = description.getTags();
    for (String tag : tags) {
      if (!DataSets.tags.containsKey(tag)) DataSets.tags.put(tag, 5);
    }
  }