Bulbs - Index Lookup

59 views Asked by At

I have a problem to find vertex by properties .

In the documentation he cites :

This will return all the vertices que have a "name " property with a value of " James" : g.vertices.index.lookup vertices = ( name = " James" ) .

I created a model called Product :

from bulbs.titan import Graph as Rexter
from bulbs.model import Node, NodeProxy, Relationship, build_data
from bulbs.property import String, Integer, DateTime
from bulbs.utils import current_datetime

# Nodes
class Product(Node):  
    element_type = "product"

    name = String(nullable=False)
    pid = Integer(nullable=False, indexed=True)
    view_count = Integer(default=0, nullable=False)
    created = DateTime(default=current_datetime, nullable=False)

And add with some information .

When i run g.vertices.index.lookup(pid =318) the return is as follows:

GET url: http://localhost:8182/graphs/graph/vertices?value=318&key=pid
GET body: None

If I am in the Gremlin and run g.V('pid', 318).map() it returns :

== > { created = 1437049813 , name = Gladiator (2000 ) , pid = 3578 ,   ELEMENT_TYPE = product, view_count = 0}

Why can not I get the vertex by Bulbs ?

Thanks!

1

There are 1 answers

0
stephen mallette On

This issue was discussed in other areas, so I'll answer here for completeness...

This issue has to do with Bulbs not explicitly adding a type hint to the URL. The following should work from a Rexster perspective:

curl "http://localhost:8182/graphs/graph/vertices?value=(i,318)&key=pid"

Discussed further in this issue:

https://github.com/espeed/bulbs/issues/156