如何在Python的Bulbs框架中为neo4j创建一个选择性的全文索引?

2024-03-29 14:25:24 发布

您现在位置:Python中文网/ 问答频道 /正文

jamesthronton提供了一个很好的例子,说明了如何配置bulls,以便将全文索引用作所有neo4j文件的默认索引:https://gist.github.com/espeed/3025438

但是,是否有一种手动管理全文索引的方法,以便它们只覆盖某些节点类型上的某些属性?如果是,怎么做?你知道吗


Tags: 文件方法httpsgithubcom类型属性节点
1条回答
网友
1楼 · 发布于 2024-03-29 14:25:24

看看我的答案如何做选择性索引灯泡没有模型。。。你知道吗

如果不想使用FulltextIndex作为默认索引(可能是出于性能原因),可以手动put要索引的值:

>>> 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()

看。。。你知道吗

要自动化全文索引行为而不使全文索引成为默认索引,请使用Model并创建一个自定义Graph对象。你知道吗

看看我的答案如何定制灯泡模型。。。你知道吗

相关问题 更多 >