Neo4j: Index date type field

 I want to search some nodes by date and time. In model,

    @Indexed
    private int startDate;
    @Indexed
    private int startTime;
    @Indexed
    private int endDate;
    @Indexed
    private int endTime;

 

A issue should be note that you should do your custom desirializer Josn to POJO in order to simplify the JSON Post.

 

Repository

@Query("MATCH (n:User)-[:Publish]->(t:NewTask) 
WHERE n.name={0} WITH t.startDate+t.startTime as time, t 
RETURN t  
ORDER BY time")

Iterable<Task>  findNewTasksPublishedByUser(String name);
    

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

References

http://grokbase.com/t/gg/neo4j/13c26tp5bg/how-to-sort-datetime-if-date-and-time-are-in-the-different-fields

http://stackoverflow.com/questions/9138857/in-neo4j-how-can-i-index-by-date-and-search-in-a-date-range

你可能感兴趣的:(index)