Examples of FastJSONObject


Examples of com.senseidb.util.JSONUtil.FastJSONObject

  @Override
  public JSONObject render(Integer reduceResult) {
    // TODO Auto-generated method stub
    try {
      return new FastJSONObject().put("distinctCount", reduceResult);
    } catch (JSONException ex) {
      throw new RuntimeException(ex);
    }
  }
View Full Code Here

Examples of com.senseidb.util.JSONUtil.FastJSONObject

  @Override
  public JSONObject render(MinResult reduceResult) {
   
    try {
      return new FastJSONObject().put("min", reduceResult.value).put("uid", reduceResult.uid);
    } catch (JSONException ex) {
      throw new RuntimeException(ex);
    }
  }
View Full Code Here

Examples of com.senseidb.util.JSONUtil.FastJSONObject

    return bool;
  }
 
 
  public static void main(String args[]) throws JSONException{
    JSONObject json = new FastJSONObject();
    JSONObject func = new FastJSONObject();
    func.put("function", "length");
    func.put("params", new FastJSONArray().put(new FastJSONArray()));
    json.put("lvalue", func);
    json.put("operator", "==");
    json.put("rvalue", 0);
   
    ConstExpQueryConstructor c = new ConstExpQueryConstructor();
View Full Code Here

Examples of com.senseidb.util.JSONUtil.FastJSONObject

  @Override
  public JSONObject render(Integer reduceResult) {
    // TODO Auto-generated method stub
    try {
      return new FastJSONObject().put("distinctCount", reduceResult);
    } catch (JSONException ex) {
      throw new RuntimeException(ex);
    }
  }
View Full Code Here

Examples of com.senseidb.util.JSONUtil.FastJSONObject

  public Query doConstructQuery(JSONObject jsonQuery) throws JSONException
  {
    Filter filter = null;
    try
    {
      JSONObject newJson = new FastJSONObject();
      newJson.put(QUERY_TYPE, jsonQuery);
      filter = FilterConstructor.constructFilter(newJson, null/* QueryParser is not used by this filter */);
    }
    catch(Exception e)
    {
      throw new JSONException(e);
View Full Code Here

Examples of com.senseidb.util.JSONUtil.FastJSONObject

  @Override
  public JSONObject render(MaxResult reduceResult) {
   
    try {
      return new FastJSONObject().put("max", reduceResult.value).put("uid", reduceResult.uid);
    } catch (JSONException ex) {
      throw new RuntimeException(ex);
    }
  }
View Full Code Here

Examples of com.senseidb.util.JSONUtil.FastJSONObject

  @Override
  public JSONObject render(AvgResult reduceResult) {
  
    try {
      return new FastJSONObject().put("avg", reduceResult.value).put("count", reduceResult.count);
    } catch (JSONException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

Examples of com.senseidb.util.JSONUtil.FastJSONObject

  {
    if (query == null) return;

    try
    {
      JSONObject jsonObj = new FastJSONObject(query.toString());
      Iterator iter = jsonObj.keys();

      final String format = "%s:%s";

      while (iter.hasNext()) {
        String key = (String) iter.next();

        if (key.equals("query")) {
          qparams.add(new BasicNameValuePair(SenseiSearchServletParams.PARAM_QUERY, jsonObj.get(key).toString()));
          continue;
        }

        qparams.add(new BasicNameValuePair(SenseiSearchServletParams.PARAM_QUERY_PARAM, String.format(format, key, jsonObj.get(key))));
      }
    }
    catch (JSONException e)
    {
      throw new SenseiException(e);
View Full Code Here

Examples of com.senseidb.util.JSONUtil.FastJSONObject

  public static JSONObject convertStreamToJSONObject(InputStream is)
      throws IOException, JSONException
  {
    String rawJSON = convertStreamToString(is);
    return new FastJSONObject(rawJSON);
  }
View Full Code Here

Examples of com.senseidb.util.JSONUtil.FastJSONObject

  public JSONObject render(ArrayList<GroupedValue> reduceResult) {
    try {
      List<JSONObject> ret = new ArrayList<JSONObject>();
      for (GroupedValue grouped : reduceResult) {
        ret.add(new FastJSONObject().put(grouped.key, grouped.value));
      }
      return new FastJSONObject().put("groupedCounts", new FastJSONArray(ret));
    } catch (JSONException ex) {
      throw new RuntimeException(ex);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.