当前位置: 首页>>代码示例>>Java>>正文


Java Index.remove方法代码示例

本文整理汇总了Java中org.neo4j.graphdb.index.Index.remove方法的典型用法代码示例。如果您正苦于以下问题:Java Index.remove方法的具体用法?Java Index.remove怎么用?Java Index.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.neo4j.graphdb.index.Index的用法示例。


在下文中一共展示了Index.remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: makeSureAdditionsCanBeRemoved

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
private void makeSureAdditionsCanBeRemoved( boolean restartTx )
{
    Index<Node> index = nodeIndex( LuceneIndexImplementation.EXACT_CONFIG );
    String key = "name";
    String value = "Mattias";
    assertNull( index.get( key, value ).getSingle() );
    Node node = graphDb.createNode();
    index.add( node, key, value );
    if ( restartTx )
    {
        restartTx();
    }
    assertEquals( node, index.get( key, value ).getSingle() );
    index.remove( node, key, value );
    assertNull( index.get( key, value ).getSingle() );
    restartTx();
    assertNull( index.get( key, value ).getSingle() );
    node.delete();
    index.delete();
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:21,代码来源:TestLuceneIndex.java

示例2: makeSureSomeAdditionsCanBeRemoved

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
private void makeSureSomeAdditionsCanBeRemoved( boolean restartTx )
{
    Index<Node> index = nodeIndex( LuceneIndexImplementation.EXACT_CONFIG );
    String key1 = "name";
    String key2 = "title";
    String value1 = "Mattias";
    assertNull( index.get( key1, value1 ).getSingle() );
    assertNull( index.get( key2, value1 ).getSingle() );
    Node node = graphDb.createNode();
    Node node2 = graphDb.createNode();
    index.add( node, key1, value1 );
    index.add( node, key2, value1 );
    index.add( node2, key1, value1 );
    if ( restartTx )
    {
        restartTx();
    }
    index.remove( node, key1, value1 );
    index.remove( node, key2, value1 );
    assertEquals( node2, index.get( key1, value1 ).getSingle() );
    assertNull( index.get( key2, value1 ).getSingle() );
    assertEquals( node2, index.get( key1, value1 ).getSingle() );
    assertNull( index.get( key2, value1 ).getSingle() );
    node.delete();
    index.delete();
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:27,代码来源:TestLuceneIndex.java

示例3: shouldNotFindValueDeletedInSameTx

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@Test
public void shouldNotFindValueDeletedInSameTx()
{
    Index<Node> nodeIndex = graphDb.index().forNodes( "size-after-removal" );
    Node node = graphDb.createNode();
    nodeIndex.add( node, "key", "value" );
    restartTx();

    nodeIndex.remove( node );
    for ( int i = 0; i < 2; i++ )
    {
        IndexHits<Node> hits = nodeIndex.get( "key", "value" );
        assertEquals( 0, hits.size() );
        assertNull( hits.getSingle() );
        hits.close();
        restartTx();
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:19,代码来源:TestLuceneIndex.java

示例4: updateIndex

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@Test
public void updateIndex() throws Exception {
    String TEXT = "text";
    String NUMERIC = "numeric";
    String TEXT_1 = "text_1";

    Index<Node> index = nodeIndex( LuceneIndexImplementation.EXACT_CONFIG );
    Node n = graphDb.createNode();
    index.add(n, NUMERIC, new ValueContext(5).indexNumeric());
    index.add(n, TEXT, "text");
    index.add(n, TEXT_1, "text");
    commitTx();

    beginTx();
    assertNotNull( index.query( QueryContext.numericRange( NUMERIC, 5, 5, true, true ) ).getSingle() );
    assertNotNull( index.get( TEXT_1, "text" ).getSingle() );
    index.remove( n, TEXT, "text" );
    index.add( n, TEXT, "text 1" );
    commitTx();

    beginTx();
    assertNotNull( index.get(TEXT_1, "text").getSingle() );
    assertNotNull( index.query(QueryContext.numericRange(NUMERIC, 5, 5, true, true)).getSingle() );
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:25,代码来源:TestLuceneIndex.java

示例5: shouldBeAbleToQueryAllMatchingDocsAfterRemovingWithWildcard

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@Test
public void shouldBeAbleToQueryAllMatchingDocsAfterRemovingWithWildcard() throws Exception
{
    // GIVEN
    Index<Node> index = nodeIndex( EXACT_CONFIG );
    Node node1 = graphDb.createNode();
    index.add( node1, "name", "Mattias" );
    finishTx( true );
    beginTx();

    // WHEN
    index.remove( node1, "name" );
    Set<Node> nodes = asSet( (Iterable<Node>) index.query( "*:*" ) );

    // THEN
    assertEquals( asSet(), nodes );
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:18,代码来源:TestLuceneIndex.java

示例6: update

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@Test
public void update()
{
    IndexManager index = graphDb.index();
    Index<Node> actors = index.forNodes( "actors" );

    // START SNIPPET: update
    // create a node with a property
    // so we have something to update later on
    Node fishburn = graphDb.createNode();
    fishburn.setProperty( "name", "Fishburn" );
    // index it
    actors.add( fishburn, "name", fishburn.getProperty( "name" ) );
    // END SNIPPET: update

    Node node = actors.get( "name", "Fishburn" ).getSingle();
    assertEquals( fishburn, node );

    // START SNIPPET: update
    // update the index entry
    // when the property value changes
    actors.remove( fishburn, "name", fishburn.getProperty( "name" ) );
    fishburn.setProperty( "name", "Laurence Fishburn" );
    actors.add( fishburn, "name", fishburn.getProperty( "name" ) );
    // END SNIPPET: update

    node = actors.get( "name", "Fishburn" ).getSingle();
    assertEquals( null, node );
    node = actors.get( "name", "Laurence Fishburn" ).getSingle();
    assertEquals( fishburn, node );
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:32,代码来源:ImdbDocTest.java

示例7: indexHitsFromQueryingRemovedDoesNotReturnNegativeCount

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@Test
public void indexHitsFromQueryingRemovedDoesNotReturnNegativeCount()
{
    Index<Node> index = nodeIndex( LuceneIndexImplementation.EXACT_CONFIG );
    Node theNode = graphDb.createNode();
    index.remove( theNode );
    IndexHits<Node> hits = index.query( "someRandomKey", theNode.getId() );
    assertTrue( hits.size() >= 0 );
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:10,代码来源:TestLuceneIndex.java

示例8: makeSureArrayValuesAreSupported

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@Test
public void makeSureArrayValuesAreSupported()
{
    Index<Node> index = nodeIndex( LuceneIndexImplementation.EXACT_CONFIG );
    String key = "name";
    String value1 = "Lucene";
    String value2 = "Index";
    String value3 = "Rules";
    assertThat( index.query( key, "*" ), isEmpty() );
    Node node = graphDb.createNode();
    index.add( node, key, new String[]{value1, value2, value3} );
    for ( int i = 0; i < 2; i++ )
    {
        assertThat( index.get( key, value1 ), contains( node ) );
        assertThat( index.get( key, value2 ), contains( node ) );
        assertThat( index.get( key, value3 ), contains( node ) );
        assertThat( index.get( key, "whatever" ), isEmpty() );
        restartTx();
    }

    index.remove( node, key, new String[]{value2, value3} );

    for ( int i = 0; i < 2; i++ )
    {
        assertThat( index.get( key, value1 ), contains( node ) );
        assertThat( index.get( key, value2 ), isEmpty() );
        assertThat( index.get( key, value3 ), isEmpty() );
        restartTx();
    }
    index.delete();
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:32,代码来源:TestLuceneIndex.java

示例9: testRemoveNumericValues

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@Test
public void testRemoveNumericValues()
{
    Index<Node> index = nodeIndex( LuceneIndexImplementation.EXACT_CONFIG );
    Node node1 = graphDb.createNode();
    Node node2 = graphDb.createNode();
    String key = "key";
    index.add( node1, key, new ValueContext( 15 ).indexNumeric() );
    index.add( node2, key, new ValueContext( 5 ).indexNumeric() );
    index.remove( node1, key, new ValueContext( 15 ).indexNumeric() );

    assertThat( index.query( NumericRangeQuery.newIntRange( key, 0, 20, false, false ) ), contains( node2 ) );

    index.remove( node2, key, new ValueContext( 5 ).indexNumeric() );

    assertThat( index.query( NumericRangeQuery.newIntRange( key, 0, 20, false, false ) ), isEmpty() );

    restartTx();
    assertThat( index.query( NumericRangeQuery.newIntRange( key, 0, 20, false, false ) ), isEmpty() );

    index.add( node1, key, new ValueContext( 15 ).indexNumeric() );
    index.add( node2, key, new ValueContext( 5 ).indexNumeric() );
    restartTx();
    assertThat( index.query( NumericRangeQuery.newIntRange( key, 0, 20, false, false ) ), contains( node1, node2 ) );
    index.remove( node1, key, new ValueContext( 15 ).indexNumeric() );

    assertThat( index.query( NumericRangeQuery.newIntRange( key, 0, 20, false, false ) ), contains( node2 ) );

    restartTx();
    assertThat( index.query( NumericRangeQuery.newIntRange( key, 0, 20, false, false ) ), contains( node2 ) );
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:32,代码来源:TestLuceneIndex.java

示例10: testRemoveWithoutKey

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@SuppressWarnings( "unchecked" )
private <T extends PropertyContainer> void testRemoveWithoutKey(
        EntityCreator<T> creator, Index<T> index ) throws Exception
{
    String key1 = "key1";
    String key2 = "key2";
    String value = "value";

    T entity1 = creator.create();
    index.add( entity1, key1, value );
    index.add( entity1, key2, value );
    T entity2 = creator.create();
    index.add( entity2, key1, value );
    index.add( entity2, key2, value );
    restartTx();

    assertContains( index.get( key1, value ), entity1, entity2 );
    assertContains( index.get( key2, value ), entity1, entity2 );
    index.remove( entity1, key2 );
    assertContains( index.get( key1, value ), entity1, entity2 );
    assertContains( index.get( key2, value ), entity2 );
    index.add( entity1, key2, value );
    for ( int i = 0; i < 2; i++ )
    {
        assertContains( index.get( key1, value ), entity1, entity2 );
        assertContains( index.get( key2, value ), entity1, entity2 );
        restartTx();
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:30,代码来源:TestLuceneIndex.java

示例11: testRemoveWithoutKeyValue

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@SuppressWarnings( "unchecked" )
private <T extends PropertyContainer> void testRemoveWithoutKeyValue(
        EntityCreator<T> creator, Index<T> index ) throws Exception
{
    String key1 = "key1";
    String value1 = "value1";
    String key2 = "key2";
    String value2 = "value2";

    T entity1 = creator.create();
    index.add( entity1, key1, value1 );
    index.add( entity1, key2, value2 );
    T entity2 = creator.create();
    index.add( entity2, key1, value1 );
    index.add( entity2, key2, value2 );
    restartTx();

    assertContains( index.get( key1, value1 ), entity1, entity2 );
    assertContains( index.get( key2, value2 ), entity1, entity2 );
    index.remove( entity1 );
    assertContains( index.get( key1, value1 ), entity2 );
    assertContains( index.get( key2, value2 ), entity2 );
    index.add( entity1, key1, value1 );

    for ( int i = 0; i < 2; i++ )
    {
        assertContains( index.get( key1, value1 ), entity1, entity2 );
        assertContains( index.get( key2, value2 ), entity2 );
        restartTx();
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:32,代码来源:TestLuceneIndex.java

示例12: testRemoveWithoutKeyFulltext

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@SuppressWarnings( "unchecked" )
private <T extends PropertyContainer> void testRemoveWithoutKeyFulltext(
        EntityCreator<T> creator, Index<T> index ) throws Exception
{
    String key1 = "key1";
    String key2 = "key2";
    String value1 = "value one";
    String value2 = "other value";
    String value = "value";

    T entity1 = creator.create();
    index.add( entity1, key1, value1 );
    index.add( entity1, key2, value1 );
    index.add( entity1, key2, value2 );
    T entity2 = creator.create();
    index.add( entity2, key1, value1 );
    index.add( entity2, key2, value1 );
    index.add( entity2, key2, value2 );
    restartTx();

    assertContains( index.query( key1, value ), entity1, entity2 );
    assertContains( index.query( key2, value ), entity1, entity2 );
    index.remove( entity1, key2 );
    assertContains( index.query( key1, value ), entity1, entity2 );
    assertContains( index.query( key2, value ), entity2 );
    index.add( entity1, key2, value1 );
    for ( int i = 0; i < 2; i++ )
    {
        assertContains( index.query( key1, value ), entity1, entity2 );
        assertContains( index.query( key2, value ), entity1, entity2 );
        restartTx();
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:34,代码来源:TestLuceneIndex.java

示例13: testRemoveWithoutKeyValueFulltext

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@SuppressWarnings( "unchecked" )
private <T extends PropertyContainer> void testRemoveWithoutKeyValueFulltext(
        EntityCreator<T> creator, Index<T> index ) throws Exception
{
    String value = "value";
    String key1 = "key1";
    String value1 = value + " one";
    String key2 = "key2";
    String value2 = value + " two";

    T entity1 = creator.create();
    index.add( entity1, key1, value1 );
    index.add( entity1, key2, value2 );
    T entity2 = creator.create();
    index.add( entity2, key1, value1 );
    index.add( entity2, key2, value2 );
    restartTx();

    assertContains( index.query( key1, value ), entity1, entity2 );
    assertContains( index.query( key2, value ), entity1, entity2 );
    index.remove( entity1 );
    assertContains( index.query( key1, value ), entity2 );
    assertContains( index.query( key2, value ), entity2 );
    index.add( entity1, key1, value1 );
    for ( int i = 0; i < 2; i++ )
    {
        assertContains( index.query( key1, value ), entity1, entity2 );
        assertContains( index.query( key2, value ), entity2 );
        restartTx();
    }
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:32,代码来源:TestLuceneIndex.java

示例14: testRemoveNodeFromIndex

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@Test
public void testRemoveNodeFromIndex()
{
    Index<Node> index = nodeIndex( LuceneIndexImplementation.EXACT_CONFIG );
    String key = "key";
    String value = "MYID";
    Node node = createAndIndexNode( index, key, value );
    index.remove( node );
    node.delete();

    Node node2 = createAndIndexNode( index, key, value );
    assertEquals( node2, index.get( key, value ).getSingle() );
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:14,代码来源:TestLuceneIndex.java

示例15: canQueryWithWildcardEvenIfAlternativeRemovalMethodsUsedInSameTx1

import org.neo4j.graphdb.index.Index; //导入方法依赖的package包/类
@Test
public void canQueryWithWildcardEvenIfAlternativeRemovalMethodsUsedInSameTx1() throws Exception
{
    Index<Node> index = nodeIndex( LuceneIndexImplementation.EXACT_CONFIG );
    Node node = graphDb.createNode();
    index.add( node, "key", "value" );
    restartTx();
    index.remove( node, "key" );
    assertNull( index.query( "key", "v*" ).getSingle() );
    assertNull( index.query( "key", "*" ).getSingle() );
}
 
开发者ID:neo4j-contrib,项目名称:neo4j-lucene5-index,代码行数:12,代码来源:TestLuceneIndex.java


注:本文中的org.neo4j.graphdb.index.Index.remove方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。