Package com.senseidb.search.client.res

Examples of com.senseidb.search.client.res.SenseiResult


   .explain(true)
   .addTemplateMapping("from", "1999")
   .addTemplateMapping("to", "2000")
   .build();
    System.out.println(JsonSerializer.serialize(request));
    SenseiResult res = senseiServiceProxy.sendSearchRequest( request);
    //System.out.println(res);
    assertEquals("numhits is wrong", 3015, res.getNumhits().intValue());

  }
View Full Code Here


    map.clear();
    map.put(1998, "red");
    valuesBuilder.addMapValue("yearcolor", map);
    valuesBuilder.addMapValue("categorycolor", Arrays.asList("compact"), Arrays.asList("white"));
    SenseiClientRequest request = SenseiClientRequest.builder().addSort(Sort.byRelevance()).query(Queries.stringQuery("").setRelevance(Relevance.valueOf(model, valuesBuilder.build()))).build();
    SenseiResult senseiResult = senseiServiceProxy.sendSearchRequest(request);
    assertEquals(10777, senseiResult.getHits().get(0).getScore().intValue());
    assertEquals(0, senseiResult.getErrorCode().intValue());
  }
View Full Code Here

    assertEquals(0, senseiResult.getErrorCode().intValue());
  }
  @Test
  public void testError() throws Exception{
    String bql = "select1 *  where color in ('red')";
    SenseiResult res = senseiServiceProxy.sendBQL(bql);
    assertEquals( 150, res.getErrorCode().intValue());
    assertEquals( 1, res.getErrors().size());
    assertEquals( "[line:1, col:0] No viable alternative (token=select1)", res.getErrors().get(0).getMessage());
    assertEquals( "BQLParsingError", res.getErrors().get(0).getErrorType());
  }
View Full Code Here

    assertEquals( "[line:1, col:0] No viable alternative (token=select1)", res.getErrors().get(0).getMessage());
    assertEquals( "BQLParsingError", res.getErrors().get(0).getErrorType());
  }
  @Test
  public void testMapReduce() throws Exception{
    SenseiResult res = senseiServiceProxy.sendSearchRequest(Examples.mapReduce(SenseiClientRequest.builder()).build());   
    assertEquals("{\"min\":2100,\"uid\":4757}", res.getMapReduceResult().toString());
   
  }
View Full Code Here

    @Test
    public void test1Deserialization() throws Exception {
        String response = new String(IOUtils.getBytes(getClass().getClassLoader().getResourceAsStream("json/senseiresult.json")), "UTF-8");
        System.out.println(new JSONObject(response).toString(2));
        SenseiResult senseiResult = JsonDeserializer.deserialize(SenseiResult.class, new JSONObject(response));
        assertEquals(senseiResult.getFacets().size(), 2);
        System.out.println(senseiResult);
    }
View Full Code Here

                .fetchStored(true)
                .addSelection(Selection.terms("color", Arrays.asList("red", "blue"), Collections.EMPTY_LIST, Operator.or))
                .build();
        String requestStr = JsonSerializer.serialize(senseiRequest).toString();
        System.out.println(requestStr);
        SenseiResult senseiResult = new SenseiServiceProxy("localhost", 8081).sendBQL(
            "SELECT *");
        System.out.println(senseiResult.toString());
    }
View Full Code Here

            .fetchStored(true)
            .addSort(Sort.desc("price"))
        .build();
        JSONObject serialized = (JSONObject) JsonSerializer.serialize(senseiRequest);
        System.out.println(serialized.toString(2));
        SenseiResult senseiResult = new SenseiServiceProxy("localhost", 8080).sendSearchRequest(senseiRequest);
        System.out.println(senseiResult);
    }
View Full Code Here

TOP

Related Classes of com.senseidb.search.client.res.SenseiResult

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.