It looks like the OR filter operator for Entity Reference fields is not currently functional. Even a single selected field returns zero results, even though the count is accurate.

I'm using the following versions: Drupal 7.14, Apache Solr 7.x-1.0-rc3, Entity Reference 7.x-1.0-rc3, Facet API 7.x-1.2

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

cpliakas’s picture

Title: OR operator returns no results for entity reference fields » The OR operator returns no results for entity reference facets
Project: Facet API » Apache Solr Search
Version: 7.x-1.2 » 7.x-1.0-rc3

Hi amanire.

Thanks for the post and the details on your environment. Facet API doesn't actually perform the facet calculations, so this is most likely an issue with Apache Solr Search Integration. Switching to that project unless it is determined the root cause is somewhere in Facet API.

Thanks,
Chris

Nick_vh’s picture

Category: bug » feature

Support for entity reference is a feature request.

Also please provide more information so we can reproduce

Nick_vh’s picture

Status: Active » Postponed (maintainer needs more info)
Paulmicha’s picture

FileSize
84.23 KB

Exact same issue here.
Versions : drupal-7.14, apachesolr-7.x-1.0-rc5 with the following patches applied : #1679392: Move logic from apachesolr_default_node_facet_info() into a separate function so other modules can use it for non-node entities and #1273658: Add the ability to filter by profile fields, apachesolr_user-7.x-1.x-dev, facetapi-7.x-1.1 and entityreference-7.x-1.0-rc3.

Steps to reproduce
In our case, it's been encoutered when searching for users :

  1. add an entityreference field on user profile (core module profile-7.14)
  2. Setup the facet for this entityreference field with "OR" :
    Configure facet display.png
  3. create/generate a bunch of users with entities referenced
  4. index these users
  5. search & check that facet fails when selecting several entities (no results instead of more results as expected with "OR")
Paulmicha’s picture

Version: 7.x-1.0-rc3 » 7.x-1.0-rc5
Category: feature » support
Status: Postponed (maintainer needs more info) » Active

Actually, should this be an issue for the Facet API module ? I'm looking at #1161434: Modify "query type" key in facet definition to accept an array and wondering if that's related (still searching).

cpliakas’s picture

Hi paul.michalet.

Probably not. Unless there is some specific piece of code you can point to or debugging that highlights Facet APi as being the problem, I would stick with debugging the Apache Solr Search Integration module. Facet API does not set the parameters on the backend, nor does it do the facet calculations. I am open a bug being in Facet API, however with issues like this is it usually an issue with the backend.

Thanks,
Chris

David_Rothstein’s picture

Title: The OR operator returns no results for entity reference facets » The OR operator returns no results for facets with colons in the value (such as entity reference facets)
Version: 7.x-1.0-rc5 » 7.x-1.x-dev
Category: support » bug
Status: Active » Needs review
FileSize
704 bytes

This seems to be because entity reference facets use values like "node:133" but the colon has a special meaning in Solr.

Based on discussion in #1154770: Must double quote filter query values if containing space or colon. it seems like code which adds the filter to the query should be responsible for fixing it (by quoting the value so Solr doesn't get confused). Conveniently there's already some very similar code there which we can reuse.

Paulmicha’s picture

Status: Needs review » Reviewed & tested by the community
Nick_vh’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)

Committed to 7.x-1.x, thanks!

pwolanin’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.