public class NodeRangeDocumentLabelScanStorageStrategy extends Object implements LabelScanStorageStrategy
LabelScanStore
implemented using Lucene. There's only one big index for all labels
because the Lucene document structure handles that quite efficiently.
With 32bit bitmaps
it would look as follows:
{ // document for nodes 0-31
range: 0
4: [0000 0001][0000 0001][0000 0001][0000 0001] -- Node#0, Node#8, Node16, and Node#24 have Label#4
7: [1000 0000][1000 0000][1000 0000][1000 0000] -- Node#7, Node#15, Node#23, and Node#31 have Label#7
9: [0000 0001][0000 0000][0000 0000][1000 0000] -- Node#7, and Node#24 have Label#9
}
{ // document for nodes 32-63
range: 1
3: [0000 0000][0001 0000][0000 0000][0000 0000] -- Node#52 has Label#3
}
i.e. each document represents a range of nodes, and in each document there is a field for each label that is present
on any of the nodes in the range. The value of that field is a bitmap with a bit set for each node in the range that
has that particular label.LabelScanStorageStrategy.StorageService
Constructor and Description |
---|
NodeRangeDocumentLabelScanStorageStrategy() |
Modifier and Type | Method and Description |
---|---|
org.neo4j.unsafe.batchinsert.LabelScanWriter |
acquireWriter(LabelScanStorageStrategy.StorageService storage) |
Iterator<Long> |
labelsForNode(org.apache.lucene.search.IndexSearcher searcher,
long nodeId) |
org.neo4j.kernel.api.direct.AllEntriesLabelScanReader |
newNodeLabelReader(org.apache.lucene.search.SearcherManager searcherManager) |
org.neo4j.collection.primitive.PrimitiveLongIterator |
nodesWithLabel(org.apache.lucene.search.IndexSearcher searcher,
int labelId) |
String |
toString() |
public NodeRangeDocumentLabelScanStorageStrategy()
public org.neo4j.collection.primitive.PrimitiveLongIterator nodesWithLabel(org.apache.lucene.search.IndexSearcher searcher, int labelId)
nodesWithLabel
in interface LabelScanStorageStrategy
public org.neo4j.kernel.api.direct.AllEntriesLabelScanReader newNodeLabelReader(org.apache.lucene.search.SearcherManager searcherManager)
newNodeLabelReader
in interface LabelScanStorageStrategy
public Iterator<Long> labelsForNode(org.apache.lucene.search.IndexSearcher searcher, long nodeId)
labelsForNode
in interface LabelScanStorageStrategy
public org.neo4j.unsafe.batchinsert.LabelScanWriter acquireWriter(LabelScanStorageStrategy.StorageService storage)
acquireWriter
in interface LabelScanStorageStrategy
Copyright © 2002–2015 The Neo4j Graph Database Project. All rights reserved.