Example usage for org.json.simple JSONObject clear

List of usage examples for org.json.simple JSONObject clear

Introduction

In this page you can find the example usage for org.json.simple JSONObject clear.

Prototype

void clear();

Source Link

Document

Removes all of the mappings from this map (optional operation).

Usage

From source file:test.SecondBigQueryTest.java

/**
 * /*from  www.  j a  v a 2 s .c o m*/
 */
public SecondBigQueryTest() {
    environment = new JSONDocStoreEnvironment();
    model = environment.getModel();
    JSONObject jo = new JSONObject();
    jo.put("id", ID);
    jo.put("subOf", ID2);
    IResult rx = model.putDocument(ID, INDEX, TYPE, jo, false);
    System.out.println("AAA " + rx.getErrorString());
    jo.clear();
    jo.put("id", ID2);
    model.putDocument(ID2, INDEX, TYPE, jo, false);
    System.out.println("BBB " + rx.getErrorString());
    jo.clear();
    jo.put("id", ID3);
    JSONArray array = new JSONArray();
    array.add(ID2);
    array.add(ID4);
    jo.put("subOf", array);
    model.putDocument(ID3, INDEX, TYPE, jo, false);
    System.out.println("CCC " + rx.getErrorString());
    String query = "{\"match\": {\"subOf\": \"" + ID2 + "\"}}";
    rx = model.runQuery(INDEX, query, 0, -1, TYPE);
    //AbstractBaseElasticSearchModel.runQuery- {"size": 12,"query": {"match": {"subOf": "AnimalType"}}}
    System.out.println(rx.hasError() + "  " + rx.getResultObject());
    if (rx.hasError())
        System.out.println("ERR " + rx.getErrorString());
    rx = model.getDocument(INDEX, TYPE, ID3);
    System.out.println(rx.hasError() + "  " + rx.getResultObject());
    environment.shutDown();
}