Announcement Announcement Module
Collapse
No announcement yet.
Solr Data faceted query Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Solr Data faceted query

    Hi!

    Please suggest a better place to ask Spring Data Solr related questions if it's not this one. Thank you.

    Basically I am wondering if there is a way to specify a faceted query without providing @Query annotation.

    It may result in solr url something like: /solr/select/?facet=true&facet.field=fashion_section_url_label

    Currently if I use:

    public interface SolrProductRepository extends SolrCrudRepository<Product, String> {
    @Facet(fields = { "section_url_label", "l2_facets", "l3_facets" }, minCount = 1)
    public FacetPage findFacetOnSection(Pageable page);
    }

    i get an Exception like:

    Caused by: java.lang.NullPointerException
    at org.springframework.data.solr.repository.support.M appingSolrEntityInformation.<init>(MappingSolrEnti tyInformation.java:44)
    at org.springframework.data.solr.repository.support.M appingSolrEntityInformation.<init>(MappingSolrEnti tyInformation.java:40)
    at org.springframework.data.solr.repository.support.S olrEntityInformationCreatorImpl.getEntityInformati on(SolrEntityInformationCreatorImpl.java:46)
    at org.springframework.data.solr.repository.query.Sol rQueryMethod.<init>(SolrQueryMethod.java:49)

    So i am forced to use @Query("*:*") along with @Facet annotation. Is there a way to avoid that?

    Leo

  • #2
    Hi Leo,
    by default SolrQueryLookupStrategy uses @Query to determine whether to derive the query from method name or not. Unfortunately I do not see a way arround this at this time. But feel free to make a proposal and or open a pull request. Maybe we'll come up with some feasable solution.

    Cheers Christoph

    Comment

    Working...
    X