dgraph icon indicating copy to clipboard operation
dgraph copied to clipboard

uuid not working as expected

Open AndreSteenbergen opened this issue 9 years ago • 7 comments

I have defines objectId : id @index When I use allof instead of eq, it works as expected...

  me(eq("name", "TestWebsite")) {
    objectId    
    name  
  }
}

results in: {"me":[{"name":"TestWebsite","objectId":"e0247678-acae-5364-89d4-e61476892142"}]}

But:

  me(eq("objectId", "e0247678-acae-5364-89d4-e61476892142")) {
    objectId    
    name  
  }
}

results in: {"code":"ErrorInvalidRequest","message":"Expected only 1 token but got: [e0247678 acae 5364 89d4 e61476892142]"} (edited)

AndreSteenbergen avatar Feb 13 '17 18:02 AndreSteenbergen

We should have a way to have an id type, where we store the string in it's entirety; so we can do equality comparisons over UUIDs and others.

manishrjain avatar Feb 16 '17 08:02 manishrjain

you need to specify exact tokenizer in schema. objectId : id @index(exact)

By default term tokenizer is picked up for strings which uses icu to tokenize the string and it splits up on "-".

janardhan1993 avatar Feb 16 '17 08:02 janardhan1993

@AndreSteenbergen Does this work for you? Can we close this issue?

pawanrawal avatar Feb 21 '17 00:02 pawanrawal

still looks strange to me that an eq function does tokenizes, but yes, can be closed.

AndreSteenbergen avatar Feb 21 '17 15:02 AndreSteenbergen

Actually, @AndreSteenbergen does have a point. eq function shouldn't be tokenizing the function arguments. We should fix that.

manishrjain avatar Feb 21 '17 17:02 manishrjain

This is related to #618, moving it to v0.8.

pawanrawal avatar Feb 22 '17 05:02 pawanrawal

If you set exact tokenizer for the predicate, then eq, leq, geq would all work; because they'd be using the exact value for comparisons.

manishrjain avatar Mar 17 '17 06:03 manishrjain