When using a Facets method in a Solr Repository in Eclipse you might encounter an exception telling you there is no facet[PropertyName] found in your Model. Here’s an example.
We’re told there’s no FacetOnAvailable Property in our Product model.
The exact error is the following, and yes, complete with exclamation marks!
Invalid derived query! No property facetOnAvailable found for type Product!
If we look at the error, this isn’t a Solr Facet issue but rather a JPA “Invalid derived query” issue. Interesting sidebar, the same code would be perfectly acceptable in IntelliJ IDEA. I don’t know if that means IntelliJ is smarter or that Eclipse is more thorough in its validation logic. Regardless, here’s the fix in Eclipse.
Since we know it’s a JPA Validation issue. We’re going to go into Eclipse Preferences -> Spring -> Validation. The “Invalid Derived Query” option is checked by default. We can disable it and the error goes away.
I still want to see evidence of Invalid Derived Queries, so I’m going to change the result from an Error to a Warning. First click the “Configure” button, then select “warning.”
With the result