1

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?

chiffa
  • 2,026
  • 3
  • 26
  • 41
  • So far it seems that adding `Graph.build_proxy(foo, FulltextIndex)` is able to build a fulltext index for a specific node type. Is it possible to do the same thing for a specific property? – chiffa Aug 22 '14 at 22:08

1 Answers1

1

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...

Community
  • 1
  • 1
espeed
  • 4,754
  • 2
  • 39
  • 51
  • Thanks. I was a bit confused on the parameters to supply to the FulltextIndex init method and couldn't find it anywhere. – chiffa Aug 26 '14 at 19:56