Database Reference
In-Depth Information
Note
IndexHits is one-time iterable. Once spent, you can't use it again. This is a constraint
of Lucene. For more information, consult the Lucene documentation at ht-
tp://lucene.apache.org .
There may be some cases where you want to find all the 34-year-old users; it's more likely
that you'll want to find users in a range. Lucene supports range queries, and many other
types of queries out of the box. Lucene details are beyond the scope of this topic, but you
can find all the details in the Lucene documentation (specifically at http://mng.bz/Lq6r ).
Note
IndexHits should be closed after use. If you iterate through all the hits (as in the pre-
vious example), IndexHits will close automatically. If you don't fully iterate through
all IndexHits values, you'll have to make sure you close it manually by calling In-
dexHits.close() . This is a constraint of Lucene; for more information, consult the
Lucene documentation at http://lucene.apache.org .
Having seen how to create and query index entries, your next concern is how to deal with
a change to the graph that requires a change to the index.
5.4. Dealing with changes to indexed data
The creation of index entries is rarely a case of create and forget. Even in this chapter's
simple example, you'd need to deal with users changing their email addresses or wanting
to delete their accounts.
Because the indexing strategies employed are entirely at the discretion of the application
developer, Neo4j can't automatically update manually created indexes to reflect changes
made to the graph itself. We'll see examples later on of how you can achieve this kind of
flexibility via other mechanisms, but for now we'll concentrate on how you can deal with
changes involving manually created indexes.
Search WWH ::




Custom Search