I am using Solr 4.6.0
and trying to import my data using CachedSqlEntityProcessor
, but somehow I end up getting a ClassCastException
.
This is a matter of case. You need to write the key in the cacheLookup attribute in upper-case. If you use
cacheLookup="publication.CONFERENCE_ID"
it will work.
All columns you gather for the entity publication
are gathered within a Map internally. The keys to that map are uppercased. When you write cacheLookup="publication.CONFERENCE_ID"
that short part after the equals sign publication.CONFERENCE_ID
is a short-cut to that map. Apparently a String#toUpper
is missing at some point in between.
I have added a test case about this, have a look at the DIHCachedTest, check it out and let it run. You will need maven for this. I create an embedded HSQLDB that mimics your schema and run an embedded Solr that does have 2 data-import configurations.
The first one is used for the test case DIHCachedTest#runImportWithFault. This will run into the same error you have posted in your question.
The second one is used for the test case DIHCachedTest#runImport. This will succeed.
If you compare both configurations, you will see that the only difference is the case of
cacheLookup="publication.CONFERENCE_ID"
vs cacheLookup="publication.conference_id"
.
The issue SOLR-2483 DIH - an uppercase problem in query parameters describes this bug pattern.