Package com.browseengine.bobo.facets

Examples of com.browseengine.bobo.facets.DefaultFacetHandlerInitializerParam


  Map<String, FacetHandlerInitializerParam> createInitParams()
  {
    Map<String, FacetHandlerInitializerParam> map = new HashMap<String, FacetHandlerInitializerParam>();

    DefaultFacetHandlerInitializerParam param;

    param = new DefaultFacetHandlerInitializerParam();
    for (int i = 0; i < 2; i++) {
      param.putBooleanParam("boolParam" + i, new boolean[]{false});
      map.put("boolFacet" + i, param);
    }

    param = new DefaultFacetHandlerInitializerParam();
    for (int i = 0; i < 2; i++) {
      param.putIntParam("intParam" + i, new int[]{42});
      map.put("intFacet" + i, param);
    }

/*  NOT YET SUPPORTED
    param = new DefaultFacetHandlerInitializerParam();
    param.putByteArrayParam("bytearrayParam", new byte[]{1, 2, 3});
    map.put("bytearrayFacet", param);
*/

    param = new DefaultFacetHandlerInitializerParam();
    for (int i = 0; i < 2; i++) {
      param.putStringParam("stringParam" + i, new ArrayList<String>(){{ add("woot"); }});
      map.put("stringFacet" + i, param);
    }

    param = new DefaultFacetHandlerInitializerParam();
    for (int i = 0; i < 2; i++) {
      param.putDoubleParam("doubleParam" + i, new double[]{3.141592});
      map.put("doubleFacet" + i, param);
    }

    param = new DefaultFacetHandlerInitializerParam();
    for (int i = 0; i < 2; i++) {
      param.putLongParam("longParam"+i, new long[]{3141592, 123456});
      map.put("longFacet"+i, param);
    }

    return map;
  }
View Full Code Here


    return protoParams.build();
  }

  private FacetHandlerInitializerParam convertFacetParam(SenseiProtos.FacetHandlerInitializerParam protoFacetHandlerInitializerParam) {
    DefaultFacetHandlerInitializerParam facetHandlerInitializerParam = new DefaultFacetHandlerInitializerParam();

    for (SenseiProtos.BooleanParams param : protoFacetHandlerInitializerParam.getBooleanParamList()) {
      boolean[] value = null;
      if(!param.getIsNull()) {
        value = new boolean[param.getValueCount()];
        for (int i = 0; i < value.length; i++) {
          value[i] = param.getValue(i);
        }
      }
      facetHandlerInitializerParam.putBooleanParam(param.getKey(), value);
    }

    for (SenseiProtos.IntParams param : protoFacetHandlerInitializerParam.getIntParamList()) {
      int[] value = null;

      if (!param.getIsNull()) {
        value = new int[param.getValueCount()];
        for (int i = 0; i < value.length; i++) {
          value[i] = param.getValue(i);
        }
      }
      facetHandlerInitializerParam.putIntParam(param.getKey(), value);
    }

    for (SenseiProtos.LongParams param : protoFacetHandlerInitializerParam.getLongParamList()) {
      long[] value = null;
      if (!param.getIsNull()) {
        value = new long[param.getValueCount()];
        for (int i = 0; i < value.length; i++) {
          value[i] = param.getValue(i);
        }
      }
      facetHandlerInitializerParam.putLongParam(param.getKey(), value);
    }

    for (SenseiProtos.StringParams param : protoFacetHandlerInitializerParam.getStringParamList()) {
      List<String> value = null;
      if(!param.getIsNull()) {
        value = param.getValueList();
      }
      facetHandlerInitializerParam.putStringParam(param.getKey(), value);
    }

    for (SenseiProtos.DoubleParams param : protoFacetHandlerInitializerParam.getDoubleParamList()) {
      double[] value = null;
      if (!param.getIsNull()) {
        value = new double[param.getValueCount()];
        for (int i = 0; i < value.length; i++) {
          value[i] = param.getValue(i);
        }
      }
      facetHandlerInitializerParam.putDoubleParam(param.getKey(), value);
    }

    for (SenseiProtos.StringParams param : protoFacetHandlerInitializerParam.getStringParamList()) {
      List<String> value = null;
      if (!param.getIsNull()) {
        value = param.getValueList();
      }
      facetHandlerInitializerParam.putStringParam(param.getKey(), value);
    }

    for (SenseiProtos.ByteArrayParams param : protoFacetHandlerInitializerParam.getByteParamList()) {
      ByteString value = null;
      if (!param.getIsNull()) {
        value = param.getValue();
      }
      facetHandlerInitializerParam.putByteArrayParam(param.getKey(), value.toByteArray());
    }

    return facetHandlerInitializerParam;
  }
View Full Code Here

  {
    logger.info("executing test case testSelection");


    SenseiRequest req = new SenseiRequest();
    DefaultFacetHandlerInitializerParam initParam = new DefaultFacetHandlerInitializerParam();
    initParam.putLongParam("time", new long[]{15000L});
    req.setFacetHandlerInitializerParam("timeRange", initParam);
    //req.setFacetHandlerInitializerParam("timeRange_internal", new DefaultFacetHandlerInitializerParam());
    req.setCount(3);
    //setspec(req, facetSpecall);
    BrowseSelection sel = new BrowseSelection("timeRange");
View Full Code Here

            Iterator<String> keyIter = facetInitParams.keys();
            while (keyIter.hasNext())
            {
              // may have multiple facets;
              String facetName = keyIter.next();
              DefaultFacetHandlerInitializerParam param =
                  new DefaultFacetHandlerInitializerParam();

              JSONObject jsonParams = facetInitParams.getJSONObject(facetName);
              if (jsonParams != null && jsonParams.length() > 0)
              {
                Iterator<String> paramIter = jsonParams.keys();
                while (paramIter.hasNext())
                {
                  // each facet may have multiple parameters to be configured;
                  String paramName = paramIter.next();
                  JSONObject jsonParamValues = jsonParams.getJSONObject(paramName);
                  String type = jsonParamValues.optString(RequestConverter2.FACETINIT_TYPE, RequestConverter2.FACETINIT_TYPE_STRING);
                  JSONArray jsonValues = jsonParamValues.optJSONArray(RequestConverter2.FACETINIT_VALUES);
                  if (jsonValues == null)
                  {
                    // Accept scalar values here too.  This is useful in
                    // supporting variable substitutions.
                    Object value = jsonParamValues.opt(RequestConverter2.FACETINIT_VALUES);
                    if (value != null)
                    {
                      jsonValues = new FastJSONArray().put(value);
                    }
                  }
                  if (jsonValues != null)
                  {
                    if (type.equals(RequestConverter2.FACETINIT_TYPE_INT))
                      param.putIntParam(paramName, convertJSONToIntArray(jsonValues));
                    else if (type.equals(RequestConverter2.FACETINIT_TYPE_STRING))
                      param.putStringParam(paramName, convertJSONToStringArray(jsonValues));
                    else if (type.equals(RequestConverter2.FACETINIT_TYPE_BOOLEAN))
                      param.putBooleanParam(paramName, convertJSONToBoolArray(jsonValues));
                    else if (type.equals(RequestConverter2.FACETINIT_TYPE_LONG))
                      param.putLongParam(paramName, convertJSONToLongArray(jsonValues));
                    else if (type.equals(RequestConverter2.FACETINIT_TYPE_BYTES))
                      param.putByteArrayParam(paramName, convertJSONToByteArray(jsonValues));
                    else if (type.equals(RequestConverter2.FACETINIT_TYPE_DOUBLE))
                      param.putDoubleParam(paramName, convertJSONToDoubleArray(jsonValues));
                  }
                }
                req.setFacetHandlerInitializerParam(facetName, param);
              }
View Full Code Here

    for (Entry<String, Configuration> facetEntry : facetEntries)
    {
      String facetName = facetEntry.getKey();
      Configuration facetConf = facetEntry.getValue();

      DefaultFacetHandlerInitializerParam facetParams = new DefaultFacetHandlerInitializerParam();

      Iterator paramsIter = facetConf.getKeys();

      while (paramsIter.hasNext())
      {
View Full Code Here

TOP

Related Classes of com.browseengine.bobo.facets.DefaultFacetHandlerInitializerParam

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.