James Thronton provides an excellent example of how to configure bulbs to use a fulltext index as default index for all neo4j fileds here: https://gist.github.com/espeed/3025438
However, is there a way of manually managing fulltext indexes so that they only cover some properties on some node types? If yes, how it is done?
See my answer on how to do selective indexing in Bulbs without models...
And if you don't want to use the FulltextIndex
as the default index (presumably for performance reasons), you can manually put
the values to be indexed:
>>> from bulbs.neo4jserver import Graph, FulltextIndex
>>> from bulbs.element import Vertex
>>> index_name="fulltext_vertex"
>>> g = Graph()
>>> g.vertices.fulltext = g.factory.get_index(Vertex, FulltextIndex, index_name)
>>> james = g.vertices.create(name="James Thornton", city="Dallas")
>>> g.vertices.fulltext.put(james.eid, name=james.name)
>>> vertices = g.vertices.fulltext.query(name="James")
>>> vertices.next()
See...
And to automate the fulltext indexing behavior without making the fulltext index the default index, use a Bulbs Model
and create a custom Graph
object.
See my answer on how to customize Bulbs models...