Example #1
0
  public ArrayList<JsonObject> ApplyFilter2(FilterExpression expression) {
    if (expression == null) {
      return FullScan(expression);
    } else {
      if (expression.IndexedCondtionsByFieldName.isEmpty()) {
        return FullScan(expression);
      }

      ArrayList<Long> setToScan = ExtractSubSetByIndexedCondtions(expression);
      return ScanSet(expression, setToScan);
    }
  }
Example #2
0
  // Apply on indexed fields conditions
  private ArrayList<Long> ExtractSubSetByIndexedCondtions(FilterExpression expression) {
    ArrayList<Long> setToScan = null;
    String globalName =
        SchemaManager.GetGlobalIndexByTableNameAndProjectId(this.TableName, this.ProjectId);
    NodeReference node =
        ConnectionManager.Instance().getConnection().createNodeReference(globalName);

    for (Map.Entry<String, ArrayList<FilterCondition>> entry :
        expression.IndexedCondtionsByFieldName.entrySet()) {
      setToScan = ExtractFromIndex(node, setToScan, expression, entry.getValue(), entry.getKey());
      // we supply a only AND filter at the moment, that's why if founded count = 0 - we can stop.
      if (setToScan.size() == 0) return setToScan;
    }
    return setToScan;
  }