Re: [Neo4j] Chyper date range query not fetching the record *

27 views
Skip to first unread message

gokulakanna balakrishnan

unread,
Nov 18, 2012, 1:32:40 PM11/18/12
to Neo4j
Hi All,

    I have converted into long format Its working fine. 

Thanks & Regards,
Gokul


On Sun, Nov 18, 2012 at 9:09 PM, gokulakanna balakrishnan <gokulb...@gmail.com> wrote:
Boxbe This message is eligible for Automatic Cleanup! (gokulb...@gmail.com) Add cleanup rule | More info

Hi All,

    I have created cypher query for fetching upcoming adventure sports. Below query is not fetching the upcoming event which fall  adventure sports registration end date should less than todays date and adventure sports enddate greater than todays date. If I remove adventureSports.registrationEndDate <{1} condition its fetching the record. I have created test record
which satisfy this condition adventureSports.registrationEndDate <{1} and adventureSports.endDate>={1} but its not fetching the record.
 
    I have added index for organizationSurrogateId,registrationEndDate,endDate and status.
 
    I have attached code below. Please help me to resolve the issue.  


 @Query("start organization=node:__types__(className=\"com.letzplay.domain.Organization\")  match (organization)-[:ORGANIZING_ADVENTURE_SPORTS]->(adventureSports)" +
                 " where organization.organizationSurrogateId={0} and adventureSports.registrationEndDate <{1} and adventureSports.endDate>={1}  and adventureSports.status={2} " +
                 " return adventureSports")
public Page<AdventureSports> getOrganizationUpcomingAdventureSports(String organizationSurrogateId,String date,String status,Pageable Page);

@NodeEntity
public class AdventureSports {

  ..etc
 
  @DateTimeFormat(style="S-")
      @Indexed
   private Date endDate;
  
   @DateTimeFormat(style="S-")
   @Indexed
   private Date registrationEndDate;
  
   @Indexed
   private String status;
}

/**
* organization can create adventure sports
 *
 * @return
 */
@Action(value = "/organizationUpcomingAdventureSports", results = { @Result(location = "organization_upcoming_adventuresports.jsp", name = "success") })
@SkipValidation
public String organizationAllUpcomingAdventureSports()
{
   String today=LetzplayCommonUtil.convertDateIntoMMYYDDFormat(new Date());
   upcomingAdventureSportsList=adventureSportsService.getOrganizationUpcomingAdventureSports(LetzplayCommonUtil.getUserFromSession().getOrganizationUser().getOrganizationSurrogateId(), today,LetzplayConstants.INITIATED_STATUS, new PageRequest(0, 3));
   upcomingAdventureSportsCount=adventureSportsService.getOrganizationUpcomingAdventureSportsCount(LetzplayCommonUtil.getUserFromSession().getOrganizationUser().getOrganizationSurrogateId(),today,LetzplayConstants.INITIATED_STATUS);
   return SUCCESS;
}

/**
* Return Date Into Month Date Year Format
 *
 * @param date
 * @return
 */
public static String convertDateIntoMMYYDDFormat(Date date){

       DateFormat  formater=new SimpleDateFormat("MM/dd/yyyy");
       return formater.format(new Date());
       
}

Thanks & Regards,
Gokul

--
 
 


Reply all
Reply to author
Forward
0 new messages