Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solr documents with multiValued fields are not parsed correctly by spring-data-solr [DATASOLR-248] #372

Closed
spring-projects-issues opened this issue Jul 1, 2015 · 0 comments

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Jul 1, 2015

Tom Persons opened DATASOLR-248 and commented

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]

Affects: 1.4 GA (Fowler)

Backported to: 2.0.2 (Hopper SR2), 1.5.5 (Gosling SR5)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants