Samuel, so, in order to do this right, we would like to associate index specific properties to nodes, in order to do things right. This is planned for Neo4j 1.7 with a much more powerful (auto)indexing framework. Before that, things would be a hack, so I think we will postponing this. However, this is very relevant even to Cypher query optimization.
Thanks for bringing this up! If you like please raise an issue on this so you can track it. Cheers, /peter neubauer GTalk: neubauer.peter Skype peter.neubauer Phone +46 704 106975 LinkedIn http://www.linkedin.com/in/neubauer Twitter http://twitter.com/peterneubauer http://www.neo4j.org - NOSQL for the Enterprise. http://startupbootcamp.org/ - Öresund - Innovation happens HERE. 2011/11/14 Samuel Feng <okos...@gmail.com> > Dear List, > > I have two questions about indexing > > *Question 1* > > At the time of creation, we can use extra configuration can be specified to > control the behavior of the index and which backend to use. > e.g, > IndexManager index = graphDb.index(); > Index<Node> movies = index.forNodes( "movies-fulltext", > MapUtil.stringMap( IndexManager.PROVIDER, "lucene", "analyzer", > "org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer" ) ); > movies.add( theMatrix, "cTitle", "黑客帝国" ); > movies.add( theMatrix, "date", "2000-01-01" ); > > When adding node "theMatrix" to index, all the values will be > analyzed/tokenized by SmartChineseAnalyzer. > However, for some fields I do not want it to be analyzed/tokenized, Any > interfaces to implement this? Can enhance valueContext so that I can pass > in something like Field.Index.NOT_ANALYZED when adding a node into index? > > *Question 2* > > For Query, > > IndexHits<Node> nodes = movies .query(new BooleanQuery(...)); > Node currentNode = null; > List<Movie> result = new ArrayList<Movie>(); > > while (nodes.hasNext()) { > currentNode = nodes.next(); > Movie m = new Movie(currentNode); > > if(m.getDate().equals("2001-01-01")){ > result.add(m); > } > } > > I found that if the indexHits is large, say size() > 20000, Each > m.getDate() will spend some time to load the value from underlying > node(especially the first-time query), So the total elapsed time is very > long. > Any interface that I can read the lucene document behind this node > directly? Maybe u can use nodes.currentDoc() to expose it? > > Thanks and Regards, > > Samuel > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user