Hi all,
there are two cases (from python and Paddys code below) where a
created index is not found. I have been trying to track it down, but
cannot reproduce it using the code at
https://trac.neo4j.org/browser/components/lucene-index/trunk/src/test/java/org/neo4j/index/impl/lucene/TestLuceneBatchInsert.java#L178
Somehow the index config in the main() code is getting result =
({type=exact}, false) back from
IndexManagerImpl.getOrCreateIndexConfig()
Pair<Map<String, String>, Boolean> result = findIndexConfig( cls,
indexName, suppliedConfig,
graphDbImpl.getConfig().getParams() );
, when before (upon the first creation) it was ({provider=lucene,
type=exact}, false). This is not happening in the unit test.
Also, this might be linked to the Python index issue earlier mentioned
on the list?
package org.neo4j;
import java.util.Map;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
import org.neo4j.graphdb.Transaction;
import org.neo4j.graphdb.index.BatchInserterIndex;
import org.neo4j.graphdb.index.BatchInserterIndexProvider;
import org.neo4j.graphdb.index.Index;
import org.neo4j.graphdb.index.IndexManager;
import org.neo4j.helpers.collection.MapUtil;
import org.neo4j.index.impl.lucene.LuceneBatchInserterIndexProvider;
import org.neo4j.kernel.EmbeddedGraphDatabase;
import org.neo4j.kernel.impl.batchinsert.BatchInserter;
import org.neo4j.kernel.impl.batchinsert.BatchInserterImpl;
public class BatchIndexTest
{
static final String DB_PATH = "target/db";
static BatchInserterIndexProvider indexProvider;
static BatchInserter inserter;
static BatchInserterIndex persons;
static GraphDatabaseService graphDb;
public static void main( String[] args )
{
inserter = new BatchInserterImpl( DB_PATH );
indexProvider = new LuceneBatchInserterIndexProvider( inserter );
persons = indexProvider.nodeIndex( "persons",
MapUtil.stringMap( "type", "exact" ) );
Map<String, Object> properties = MapUtil.map( "name", "test" );
long node = inserter.createNode( properties );
persons.add( node, properties );
indexProvider.shutdown();
inserter.shutdown();
graphDb = new EmbeddedGraphDatabase( DB_PATH );
Transaction tx = graphDb.beginTx();
try
{
IndexManager indexManager = graphDb.index();
System.out.println( indexManager.forRelationships( "persons" ) );
System.out.println( indexManager.existsForNodes( "persons"
) ); // returns
// true
// Getting an error with the following code
Index<Node> nodes = indexManager.forNodes( "persons" );
System.out.println( nodes );
tx.success();
}
finally
{
tx.finish();
graphDb.shutdown();
}
}
}
Cheers,
/peter neubauer
_______________________________________________
Neo4j mailing list
[email protected]
https://lists.neo4j.org/mailman/listinfo/user