Package org.neo4j.index.lucene

Examples of org.neo4j.index.lucene.ValueContext


    node1.setProperty("label", "my first, and node- stopword working practice Title!");
    node2.setProperty("label", "Secondos, and Nodos");
    node3.setProperty("label", "Tertios, Nodos");
    node4.setProperty("label", "Quartios- Nodos");

    index.add(node1 ,"score", new ValueContext( 1 ).indexNumeric());
    index.add(node2 ,"score", new ValueContext( 0 ).indexNumeric());
    index.add(node3 ,"score", new ValueContext( 2 ).indexNumeric());
    index.add(node4 ,"score", new ValueContext( 3 ).indexNumeric());

   
    index.add(node1, "label", node1.getProperty("label"));
    index.add(node2, "label", node2.getProperty("label"));
    index.add(node3, "label", node3.getProperty("label"));
View Full Code Here


        //if (n.hasProperty(DBNodeProperties.URI)) continue;
       
        if (NodeType.isPaperNode(n) && n.hasProperty(DBNodeProperties.PAGE_RANK_VALUE)){
          // add paper node to index
          searchIndex.add(n, "key", (String)n.getProperty("title"));
          searchIndex.add(n, "score", new ValueContext((Double)n.getProperty(DBNodeProperties.PAGE_RANK_VALUE)).indexNumeric());
          searchIndex.add(n, "type", "paper");
          registerURI(n, "paper:" + (String)n.getProperty("c_authors") + ";" + (String)n.getProperty("title") );
        } else if (NodeType.isAuthorNode(n) && n.hasProperty(DBNodeProperties.PAGE_RANK_VALUE)) {
          // add author node to index
          searchIndex.add(n, "key", (String)n.getProperty("name"));
          searchIndex.add(n, "score", new ValueContext((Double)n.getProperty(DBNodeProperties.PAGE_RANK_VALUE)).indexNumeric());
          searchIndex.add(n, "type", "author");
          registerURI(n, "author:" + (String)n.getProperty("name") );
        } else {
          System.out.println("Skipped node: "+ n.toString());
         
View Full Code Here

        this.underlyingNode.setProperty( Stop.FROMHUB,stop.fromHub );
        this.underlyingNode.setProperty( Stop.TOHUB, stop.toHub );
        this.underlyingNode.setProperty( Stop.TIMEFROMHUB, stop.timeFromHub );
        this.underlyingNode.setProperty( Stop.TIMETOHUB, stop.timeToHub );

        stopLayer.add( underlyingNode, Stop.STOPNUM, new ValueContext(Integer.parseInt( stop.stopId.trim() )).indexNumeric() );
        stopLayer.add( underlyingNode, STOPID, route.direction + route.routeId + stop.stopId );
        stopLayer.add( underlyingNode, ROUTEID, route.direction + route.routeId );
       
    }
View Full Code Here

        }
        return result;
    }

    protected Object convertIfNecessary(Neo4jTemplate template, Object value, Neo4jPersistentProperty property) {
        if (property.isIndexedNumerically()) return new ValueContext(value).indexNumeric();
        if (property.isNeo4jPropertyType() && property.isNeo4jPropertyValue(value)) return value;

        PropertyConverter converter = new PropertyConverter(template.getConversionService(), property);
        return converter.serializeIfNotBuiltIn(value);
    }
View Full Code Here

        }
        // END SNIPPET: wildcardTermQuery
        assertEquals( 2, hits.size() );

        // START SNIPPET: numericRange
        movies.add( theMatrix, "year-numeric", new ValueContext( 1999L ).indexNumeric() );
        movies.add( theMatrixReloaded, "year-numeric", new ValueContext( 2003L ).indexNumeric() );

        // Query for range
        long startYear = 1997;
        long endYear = 2001;
        hits = movies.query( NumericRangeQuery.newLongRange( "year-numeric", startYear, endYear, true, true ) );
View Full Code Here

    {
        Index<Node> index = nodeIndex( "numeric2", 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 ) );
View Full Code Here

TOP

Related Classes of org.neo4j.index.lucene.ValueContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.