Regarding FullText Search

Showing 1-8 of 8 messages
Regarding FullText Search gokulakanna balakrishnan 7/3/12 2:11 PM
Hi All,

   I am implement fulltext search in application. I am trying to do pagination for that I need number of mathing record.
I have wrote following queries for gettting matching count. But I am getting exception.

public class Team{

@Indexed(indexType=IndexType.FULLTEXT, indexName = "teamSearch")
private String searchTeamName;
...
...
}
 

@Query("start team=node:__types__(className=\"com.letzplay.domain.Team\")(searchTeamName = {0}) return count(team)")
    public Integer getCountBySearchTeam(String name);


Exception:

org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement start team=node:__types__(className="com.letzplay.domain.Team")(searchTeamName = {0}) return count(team); nested exception is expected return clause "start team=node:__types__(className="com.letzplay.domain.Team")(searchTeamName = {0}) return count(team)" ^


@Query("start team=node:__types__(className=\"com.letzplay.domain.Team\") where team.searchTeamName={0} return count(team)")
public Integer getCountBySearchTeam(String name);

Exception: NullPointerException throwing.


Please help me fix above issue. Last two days I am struggling to fix this problem.

Thanks & Regards,
Gokul
Re: [Neo4j] Regarding FullText Search Michael Hunger 7/3/12 4:53 PM
@Query("start team=node:searchTeamName({0}) return count(team)")
public Integer getCountBySearchTeam(String searchQuery);

you have to pass in: "searchTeamName:searchterm" as parameter to the method.

MIchael

Am 03.07.2012 um 23:11 schrieb gokulakanna balakrishnan:
Re: [Neo4j] Regarding FullText Search gokulakanna balakrishnan 7/4/12 6:32 AM
Hi Michael,

Thanks alot for helping me Michael.

I have modified full text search query. I am getting null pointer
exception. I have added my source code below.

@NodeEntity
public Team
{

   @Indexed(indexType=IndexType.FULLTEXT, indexName = "teamSearch")
   private String searchTeamName;
}


public interface TeamRepository extends
GraphRepository<Team>,NamedIndexRepository<Team>,RelationshipOperationsRepository<Team>
{

        @Query("start team=node:searchTeamName({0}) return count(team)")
        public Integer getCountBySearchTeam(String searchQuery);

}


@ParentPackage(value = "letzplay")
public SearchAction
{

        public String search() throws Exception {
        
            int count=teamRepository.getCountBySearchTeam("searchTeamName:"+name);
        }
}


Exception: NullPointerException

Thanks & Regards,
Gokul
Re: [Neo4j] Regarding FullText Search Michael Hunger 7/4/12 7:04 AM
Can you make the int count into a Integer count = …

Do you have a full stacktrace for the exception?

Thanks

Michael

Am 04.07.2012 um 15:32 schrieb gokulakanna balakrishnan:
Re: [Neo4j] Regarding FullText Search gokulakanna balakrishnan 7/4/12 7:28 AM
Hi Michael,

     After changing into integer its not throwing exception. But
search result is coming as null. But data is in the database.

Thanks & Regards,
Gokul
Re: [Neo4j] Regarding FullText Search gokulakanna balakrishnan 7/4/12 7:50 AM
Hi Michael,

    teamRepository.findBySearchTeamNameLike(name) - is returning
result for same search criteria.

Thanks & Regards,
Gokul
Re: [Neo4j] Regarding FullText Search Michael Hunger 7/4/12 8:42 AM
Your index name in the cypher query is wrong

It must be node:teamSearch

Sent from mobile device

Am 04.07.2012 um 16:50 schrieb gokulakanna balakrishnan <gokulb...@gmail.com>:
Re: [Neo4j] Regarding FullText Search gokulakanna balakrishnan 7/6/12 5:33 AM
Hi Michael,

     Thanks alot. Its working fine.

  Thanks & Regards,
Gokul