コード例 #1
0
  /** @param _parameter */
  public Return execute(final Parameter _parameter) throws EFapsException {
    Return ret = new Return();
    Map properties = (Map) _parameter.get(ParameterValues.PROPERTIES);

    String types = (String) properties.get("Types");

    boolean expandChildTypes = "true".equals((String) properties.get("ExpandChildTypes"));

    if (LOG.isDebugEnabled()) {
      LOG.debug("types=" + types);
    }

    SearchQuery query = new SearchQuery();
    query.setQueryTypes(types);
    query.setExpandChildTypes(expandChildTypes);
    query.addSelect("OID");
    query.execute();

    List<List<Instance>> list = new ArrayList<List<Instance>>();
    while (query.next()) {
      List<Instance> instances = new ArrayList<Instance>(1);
      instances.add(new Instance((String) query.get("OID")));
      list.add(instances);
    }

    ret.put(ReturnValues.VALUES, list);

    return ret;
  }
コード例 #2
0
  /**
   * Reads all StopWords which are linked to an <b>Lucene_Analyzer</b> from the Database and returns
   * a Set of Stopwords
   *
   * @param _AnalyzerID the ID of an Lucene_Analyzer
   * @return Set of Stopwords
   */
  public static Set getStopWords(String _AnalyzerID) {
    Set<String> StopWords = new HashSet<String>();
    SearchQuery query = new SearchQuery();
    try {
      query.setQueryTypes("Lucene_StopWords");
      query.addSelect("Word");
      query.addWhereExprEqValue("Analyzer", _AnalyzerID);
      query.execute();
      while (query.next()) {
        StopWords.add(query.get("Word").toString());
      }
      return StopWords;
    } catch (EFapsException e) {
      LOG.error("getStopWords(String)", e);
    }

    return null;
  }
コード例 #3
0
  /**
   * Searches for an existing Stopword with the parameters as a filter and returns the ID of the
   * StopWord
   *
   * @param _AnalyzerID ID of a Lucene_Analyzer
   * @param _Word StopWord
   * @return ID if exits, else null
   */
  private static String getIDofExistingStopWord(String _AnalyzerID, String _Word) {
    SearchQuery query = new SearchQuery();
    try {
      query.setQueryTypes("Lucene_StopWords");
      query.addSelect("ID");
      query.addWhereExprEqValue("Word", _Word);
      query.addWhereExprEqValue("Analyzer", _AnalyzerID);
      query.execute();
      if (query.next()) {
        return query.get("ID").toString();
      }
    } catch (EFapsException e) {

      LOG.error("getIDofExistingStopWord(String, String)", e);
    }

    return null;
  }