#715 Grammer for filtering based on nested HDict

Ryan Mattison Thu 13 Jun 2019

Hello,

If I have a structure such as

{range:{stdt:2019-06-13T15:27:27.783-05:00 Chicago etdt:2019-06-13T15:27:27.810-05:00 Chicago} dis:"Simple Vacation" vacation temp kind:"Number" schedule unit:"\\u00B0F" cooling}

What is the notation for filtering against the inner range objects?

range,dis,vacation,id,temp,kind,schedule,unit,cooling {stdt:2019-06-13T15:38:04.809-05:00 Chicago etdt:2019-06-13T15:38:04.809-05:00 Chicago},"Simple Vacation",M,@5d02b42c96348f7493b20616,M,"Number",M,"\\u00B0F",M

Should these -> reach inside of the range object?

Filter: vacation and range->stdt < 2019-06-13T15:38:06.276-05:00 Chicago

BSON Filter: And Filter{filters=[Operator Filter{fieldName='vacation', operator='$exists', value=BsonBoolean{value=true}}, Operator Filter{fieldName='range', operator='$lt', value=1560458286276}]} Filter: vacation and range->stdt > 2019-06-13T15:38:06.339-05:00 Chicago

BSON Filter: And Filter{filters=[Operator Filter{fieldName='vacation', operator='$exists', value=BsonBoolean{value=true}}, Operator Filter{fieldName='range', operator='$gt', value=1560458286339}]}

HDict hDict = new HDictBuilder()
            .add("stdt", HDateTime.make(System.currentTimeMillis()))
            .add("etdt", HDateTime.make(System.currentTimeMillis())).toDict();

    HDict hDictEmbed = new HDictBuilder()
            .add("unit", "\\u00B0F")
            .add("kind", "Number")
            .add("temp")
            .add("schedule")
            .add("vacation")
            .add("range", hDict)
            .add("dis", "Simple Vacation")
            .add("cooling").toDict();


    HGrid dictToGrid = HGridBuilder.dictToGrid(hDictEmbed);

    System.out.println("Vacation Format: " + hDictEmbed.toZinc());


    HGrid addEntity = db.addEntity(dictToGrid);

    addEntity.dump();


    HGrid readAllResults = db.readAll("vacation and range->stdt < " + HDateTime.make(System.currentTimeMillis()).toZinc());
    HGrid readAllNoResults = db.readAll("vacation and range->stdt > " + HDateTime.make(System.currentTimeMillis()).toZinc());

Matthew Giannini Fri 14 Jun 2019

Hi Ryan, the -> should pass through a nested Dict. Let me look at the code and at a fix for this.

Matthew Giannini Fri 14 Jun 2019

Ryan - I pushed a changeset to the haystack-java repo that should fix this.

Ryan Mattison Fri 14 Jun 2019

Thanks!

Login or Signup to reply.