private void ReadTerms(ITermsQuery termsQuery, JsonReader reader) { reader.Read(); if (reader.TokenType == JsonToken.StartObject) { var ef = new ExternalFieldDeclaration(); var depth = reader.Depth; while (reader.Read() && reader.Depth >= depth && reader.Value != null) { var property = reader.Value as string; switch (property) { case "id": reader.Read(); ef.Id = reader.Value as string; break; case "index": reader.Read(); ef.Index = reader.Value as string; break; case "type": reader.Read(); ef.Type = reader.Value as string; break; case "path": reader.Read(); ef.Path = reader.Value as string; break; } } termsQuery.ExternalField = ef; } else if (reader.TokenType == JsonToken.StartArray) { var values = JArray.Load(reader).Values <string>(); termsQuery.Terms = values; } }
private void ReadTerms(ITermsQuery termsQuery, JsonReader reader) { reader.Read(); if (reader.TokenType == JsonToken.StartObject) { var ef = new ExternalFieldDeclaration(); var depth = reader.Depth; while (reader.Read() && reader.Depth >= depth && reader.Value != null) { var property = reader.Value as string; switch (property) { case "id": reader.Read(); ef.Id = reader.Value as string; break; case "index": reader.Read(); ef.Index = reader.Value as string; break; case "type": reader.Read(); ef.Type = reader.Value as string; break; case "path": reader.Read(); ef.Path = reader.Value as string; break; } } termsQuery.ExternalField = ef; } else if (reader.TokenType == JsonToken.StartArray) { var values = JArray.Load(reader).Values<string>(); termsQuery.Terms = values; } }