Uploaded image for project: 'Spring Data for Apache Solr'
  1. Spring Data for Apache Solr
  2. DATASOLR-248

Solr documents with multiValued fields are not parsed correctly by spring-data-solr



    • Sprint:
      Hopper SR2


      This affects version 1.4.1. It may also affect 1.4.0 but I wasn't able to get that far due to a different error with the data model (Entity) class not being found by the class loader in spring-data-solr.

      Steps to reproduce:

      1) Create a solr database by running the schemaless example database that ships with solr 4.10.1
      2) post a document to that database that has an "id" field and a number of additional fields of various types (string, integer, lat long, date)
      3) The managed schema will by default create all of the fields except for the "id" field as multiValued
      4) Create a play framework 2.3.8 application and add spring-data-solr 1.4.1.RELEASE as a dependency
      5) Create all of the appropriate hooks in the app for spring (app context, java config, entity class, repository interface, etc...)
      6) In the repository interface create a new query based on one of the multiValued fields (such as findByDocType(String docType))
      7) Use this query in the application and print the results of the query to stdout

      expected result:
      All of the documents in the database that match the query should be returned to the client application and the results should be printed

      actual result:
      A null pointer exception is thrown in MappingSolrConverter.SolrPropertyValueProvider.readValue(). The null pointer is returned by type.getComponentType() in MappingSolrConverter.SolrPropertyValueProvider.readCollection().

      If I change the managed schema of the schemaless example database in solr so that all of my fields have multiValued="false" then this error does not occur and the proper results are returned.

      stack trace:

      play - Cannot invoke the action, eventually got an error: java.lang.IllegalArgumentException: [Assertion failed] - this argument is required; it must not be null
      application - 
      ! @6mjm25f1f - Internal server error, for (GET) [/] ->
      play.api.Application$$anon$1: Execution exception[[IllegalArgumentException: [Assertion failed] - this argument is required; it must not be null]]
      	at play.api.Application$class.handleError(Application.scala:296) ~[play_2.11-2.3.8.jar:2.3.8]
      	at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.11-2.3.8.jar:2.3.8]
      	at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.8.jar:2.3.8]
      	at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$4.apply(PlayDefaultUpstreamHandler.scala:320) [play_2.11-2.3.8.jar:2.3.8]
      	at scala.Option.map(Option.scala:145) [scala-library-2.11.4.jar:na]
      Caused by: java.lang.IllegalArgumentException: [Assertion failed] - this argument is required; it must not be null
      	at org.springframework.util.Assert.notNull(Assert.java:112) ~[spring-core-4.0.9.RELEASE.jar:4.0.9.RELEASE]
      	at org.springframework.util.Assert.notNull(Assert.java:123) ~[spring-core-4.0.9.RELEASE.jar:4.0.9.RELEASE]
      	at org.springframework.data.solr.core.convert.MappingSolrConverter$SolrPropertyValueProvider.readValue(MappingSolrConverter.java:341) ~[spring-data-solr-1.4.1.RELEASE.jar:na]
      	at org.springframework.data.solr.core.convert.MappingSolrConverter$SolrPropertyValueProvider.readCollection(MappingSolrConverter.java:481) ~[spring-data-solr-1.4.1.RELEASE.jar:na]
      	at org.springframework.data.solr.core.convert.MappingSolrConverter$SolrPropertyValueProvider.readValue(MappingSolrConverter.java:355) ~[spring-data-solr-1.4.1.RELEASE.jar:na]




            cstrobl Christoph Strobl
            blast7 Tom Persons
            Last updater:
            Spring Issues Spring Issues
            0 Vote for this issue
            1 Start watching this issue