Search code examples
javaspringspring-bootneo4jspring-data-neo4j-4

Cannot search movies in Neo4j Movies sample application


On Ubuntu 16.10 I have followed the instruction from:

https://github.com/neo4j-examples/movies-java-spring-data-neo4j-4

But when I go to http://localhost:8080/ and try to search for e.g. Matrix nothing happens, it just looks empty:

enter image description here

I have verified that the neo4j db has been populated with the required data and I also updated user/pass in the .properties file in the maven project.

Any ideas, and is it possible to find a log somewhere?

Pressing F12 in Firefox gives:

enter image description here

Indicating the error in the sources as described in the below answer, did not manage to get the same error info in Chrome when pressing F12 though.


Solution

  • The code in the GitHub project is not properly updated. The MovieRepository.java class has findByTitleContaining method and @param is missing in this method. If you check the index.html file, javascript code is executing /movies/search/findByTitleLike?title=* URL. The quick fix will be add following method in MovieRepository.java and then execute mvn spring-boot:run command again.

    Collection<Movie> findByTitleLike(@Param("title") String title);
    

    In order to have proper source and test classes, you should replace findByTitleContaining method with findByTitleLike method in MovieRepository.java class and also fix the MovieRepositoryTest.java class to use the correct method. Delete testFindByTitleContaining method and add following method in MovieRepositoryTest.java class.

    @Test
    public void testFindByTitleLike() {
        String title = "Matrix";
        Collection<Movie> result = instance.findByTitleLike("*"+title+"*");
        assertNotNull(result);
        assertEquals(1, result.size());
    }