Re: [Neo4j] FullTextSearch fails for JavaRestAPI in 1.7 & 1.8-SNAPSHOT

18 views
Skip to first unread message

Michael Hunger

unread,
Aug 14, 2012, 6:10:00 AM8/14/12
to ne...@googlegroups.com
Please note that transactions as such don't have the same semantics in the REST API

in 1.7 of the rest-bindings they are just silently ignored
in 1.8 they are aggregating the commands that are in the tx in a batch-request, but query/get commands don't have fully fetched value object up until the tx has been finished

But you're right there is an issue, in handling the batch-composition of node creation and index addition.

I look into it.
Meanwhile you can remove the transaction surrounding that, and it should work (just for now).


Am 14.08.2012 um 08:57 schrieb skulrb:

Hi,

JavaRestAPI fails in FullTextSearch in 1.7 & 1.8-SNAPSHOT.

Node and Index are created in the DB, but the node property is not set in the DB.

Example source code is  :https://github.com/skulrb/RedbasinNeo4jTests
n


tx
Smitha Kulkarni

Michael Hunger

unread,
Aug 14, 2012, 1:24:55 PM8/14/12
to ne...@googlegroups.com
Hi,

sorry to say but I just wasted two hours on this. 

The problem in the end was that you had a space in the "fulltext " index configuration which caused Neo4j not being able to locate the correct type of index.

Please use the constants defined in LuceneIndexImplementation for refering to the index.

Also operations on the index results must happen after tx.finish(), aka after the batch-rest-operation returned.

See below.

Michael

    public static void main( String[] args ) throws java.io.IOException, URISyntaxException
    {

        setup();
        Transaction tx = graphDb.beginTx();
        Node geneNode = null;
        // there was a SPACE in the index-type, dammit
        // RestIndex<Node> index = graphDb.index().forNodes( "genefull", MapUtil.stringMap( IndexManager.PROVIDER, "lucene", "type", "fulltext_ _" ) );
        // use the constants
        RestIndex<Node> index = graphDb.index().forNodes("genefull", LuceneIndexImplementation.FULLTEXT_CONFIG);
        try
        {

            geneNode = graphDb.createNode();
            index.add( geneNode, "geneid", "gene" );

            tx.success();
        }
        catch ( Exception e )
        {
            System.out.println( "exception caught" + e.toString() );
            e.printStackTrace();
        }
        finally
        {
            System.out.println( "finally" );
            tx.finish();
            System.out.println( "came out of finally" );
        }

        IndexHits<Node> hits = index.get("geneid", "gene");
        int num = hits.size();
        System.out.println( "num = " + num );
        assert num == 1;
        assert geneNode.equals( hits.getSingle() );

    }

skulrb

unread,
Aug 15, 2012, 1:29:11 PM8/15/12
to ne...@googlegroups.com
Hi,

Thank you for looking into this problem.

Is the "tx" transaction still stands to be operational in 1.8 and not in 1.7?

Regards
Smitha Kulkarni
Redbasin Networks

Michael Hunger

unread,
Aug 15, 2012, 9:00:08 PM8/15/12
to ne...@googlegroups.com
Sorry I don't understand

Sent from mobile device
--
 
 
Reply all
Reply to author
Forward
0 new messages