1
DocumentAccess access = DocumentAccess.createDefault();
        DocumentType type = access.getDocumentTypeManager().getDocumentType("location");
 DocumentId id = new DocumentId("id:location:location::4");
        Document document = new Document(type, id);
        document.setFieldValue(document.getDataType().getField("token"), "qwerty");
        **document.setFieldValue(document.getDataType().getField("latlong"),"N28.6273348;E77.4327459");**
        document.setFieldValue(document.getDataType().getField("data_timestamp"), "00:00:00 00:00:00");

When adding latlong field of Position type, I am getting this error in search API.

"message": "Invalid search request [/search/?query=dcnQ8ar52Y]: Type class com.yahoo.document.datatypes.StringFieldValue can not specify a class com.yahoo.document.datatypes.Struct instance"
Mohammad Sunny
  • 371
  • 1
  • 3
  • 15

1 Answers1

3

Use com.yahoo.document.PositionDataType.fromString("N28.6273348;E77.4327459")

Jo Kristian Bergum
  • 2,984
  • 5
  • 8