Repository: incubator-s2graph Updated Branches: refs/heads/master b8f990504 -> a18ec278e
refactoring Project: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/commit/70da1500 Tree: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/tree/70da1500 Diff: http://git-wip-us.apache.org/repos/asf/incubator-s2graph/diff/70da1500 Branch: refs/heads/master Commit: 70da15004ebf33a8590b89d9e916ba2d1e70da1f Parents: a07c4d2 Author: daewon <[email protected]> Authored: Mon Apr 23 18:02:51 2018 +0900 Committer: daewon <[email protected]> Committed: Mon Apr 23 18:02:51 2018 +0900 ---------------------------------------------------------------------- .../s2graph/core/index/ESIndexProvider.scala | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-s2graph/blob/70da1500/s2core/src/main/scala/org/apache/s2graph/core/index/ESIndexProvider.scala ---------------------------------------------------------------------- diff --git a/s2core/src/main/scala/org/apache/s2graph/core/index/ESIndexProvider.scala b/s2core/src/main/scala/org/apache/s2graph/core/index/ESIndexProvider.scala index fbf76ef..27039e5 100644 --- a/s2core/src/main/scala/org/apache/s2graph/core/index/ESIndexProvider.scala +++ b/s2core/src/main/scala/org/apache/s2graph/core/index/ESIndexProvider.scala @@ -29,8 +29,9 @@ import org.apache.hadoop.hbase.master.procedure.ProcedureSyncWait.Predicate import org.apache.s2graph.core.io.Conversions import org.apache.s2graph.core.mysqls._ import org.apache.s2graph.core.types.VertexId -import org.apache.s2graph.core.{EdgeId, S2EdgeLike, S2VertexLike, VertexQueryParam} +import org.apache.s2graph.core._ import org.apache.tinkerpop.gremlin.process.traversal.step.util.HasContainer +import org.apache.tinkerpop.gremlin.structure.Property import play.api.libs.json.{Json, Reads} import scala.collection.JavaConverters._ @@ -67,10 +68,10 @@ class ESIndexProvider(config: Config)(implicit ec: ExecutionContext) extends Ind props.foreach { case (dim, s2VertexProperty) => // skip reserved fields. if (s2VertexProperty.columnMeta.seq > 0) { - s2VertexProperty.columnMeta.dataType match { - case "string" => fields += (dim -> s2VertexProperty.innerVal.value.toString) - case _ => fields += (dim -> s2VertexProperty.innerVal.value) - } + val innerVal = vertex.propertyValue(dim).get + val cType = s2VertexProperty.columnMeta.dataType + + fields += (dim -> JSONParser.innerValToAny(innerVal, cType)) } } @@ -92,10 +93,10 @@ class ESIndexProvider(config: Config)(implicit ec: ExecutionContext) extends Ind props.foreach { case (dim, s2Property) => if (s2Property.labelMeta.seq > 0) { - s2Property.labelMeta.dataType match { - case "string" => fields += (dim -> s2Property.innerVal.value.toString) - case _ => fields += (dim -> s2Property.innerVal.value) - } + val innerVal = edge.propertyValue(dim).get.innerVal + val cType = s2Property.labelMeta.dataType + + fields += (dim -> JSONParser.innerValToAny(innerVal, cType)) } } @@ -197,7 +198,7 @@ class ESIndexProvider(config: Config)(implicit ec: ExecutionContext) extends Ind val field = vidField val empty = new util.ArrayList[VertexId]() - vertexQueryParam.searchString match { + vertexQueryParam.searchString match { case Some(queryString) => fetchInner[VertexId](queryString, GlobalIndex.VertexIndexName, field, Conversions.s2VertexIdReads)(v => VertexId.isValid(v).isDefined) case None => Future.successful(empty)
