Maybe the answer is obvious. I had assumed that since this is built on Search API and Search API Solr, facets would be part of the deal as well. After spending the past couple of days with this I finally have a view setup that will search my external Solr index but have hit a dead end with the facets. The only field available for me to facet on is the "id" which is the field that was selected as the entity type.

I don't see any way to add additional fields or facets when editing the Sarnia index.

Any advice?

Comments

becw’s picture

I'm not sure; the bulk of Sarnia was done before the Facet API module was available, so I haven't used the Facet API for anything. Sarnia overrides the fields available to Search API when it comes to searching, and since Search API does not write to Sarnia indexes, Search API's index field configuration isn't used to describe what is available in the Solr core.

So, this is an open question and needs more research.

cappadona’s picture

Ah...that explains it...thanks for the explanation. It would be great if we could use facets with Sarnia indexes. I think I'm probably going to go back to ApacheSolr for my search needs but will probably use Sarnia when I want to list content due to the Views integration.

Thanks for the great module.

christowm’s picture

I ran into the same problem. Until the facet api implementation has been added, there is a work-around. In our case, we enabled the "old search facet" module. That allowed us to use the search facet type of capability. Of course, the old search facet module is deprecated, so I don't know for how long that feature will be available, but at least it works.

cappadona’s picture

Saw that old search facet sitting on the modules page but never bothered enabling it. I'll check it out...thanks for the heads up.

christowm’s picture

Hi folks,

Since the deprecated search facets are working for Sarnia, I would venture to guess that the new implementation of the facet API should be able to accomodate Sarnia as well. So I would like to request that this feature be included in a future release of Sarnia.

becw’s picture

Component: Documentation » Code
Status: Active » Fixed

I've updated Sarnia to work with FacetAPI; this involved:

  • Telling FacetAPI about fields that can be used as facets
  • Quoting facet values appropriately in Solr queries
  • Preventing facets from being applied when Sarnia loads entities

Let me know how it works for you.

egarias’s picture

Tried the new dev version 2012-Apr-24 but no luck with facets.
I have a lot of fields indexed but in the facets tab i only see the id field.
What do I have to do??
Thanks for this GREAAAAAAT Module!

becw’s picture

@egarias Do you have the search_api_facetapi module enabled?

egarias’s picture

I'm Sorry, Search Facet was not enabled,

I have now facets but for the properties with schema

indexed, stored

The properties that are

indexed, tokenized, stored, multivalued

are not available as facets.

is this normal?
I would have facets for those properties, would it be possible?

I also have this error

Warning: call_user_func(SarniaFacetapiTerm::getType) [function.call-user-func]: First argument is expected to be a valid callback in FacetapiAdapter->__construct() (line 104 of /var/www/clients/client1/web5/web/sites/all/modules/facetapi/plugins/facetapi/adapter.inc).

in admin/config/search/search_api/index/sarnia_solr/facets

becw’s picture

Ah, interesting. I only made the "display" solr properties available, which is why you're seeing only "indexed, stored" properties. The issue with using tokenized properties as facets is that the tokens are used as facet values. For example, if you had a property where the original value was "South America", and the property has some sort of text tokenization, you would see two facets for it: "south" and "america".

The correct behavior would be that any property that is indexed, stored, and NOT tokenized should be available as a facet, like this:

faceted:

  • indexed, stored
  • indexed, stored, multivalued

not faceted:

  • indexed, stored, tokenized, multivalued
  • indexed, tokenized

I'll look into that warning you're seeing. Thank you so much for the feedback!

egarias’s picture

Thanks!
I want to ask a favor, Do you know whether i can modify the schema of my solr modifying the tokenized to not tokeninzed without loosing data?

I think this is an excelent module. I do have Drupal installations that i fill from external data then I don't need the whole drupal node for this content. I had made a specific xmlsitemap module for that content, is a content stored in solr but displayed in drupal, like any other content, this lets me have a lightweight drupal and a large data site capable.

Thanks again

becw’s picture

@egarias If you change a field in your Solr schema from tokenized to not tokenized, it will change the way Solr searches on that field. In a tokenized field, "south" will find "South America". In a field that is not tokenized, only an exact match will find values--so only "South America" would find "South America". This really only matters if you're using an exposed Views filter on that field.

It's possible that you'll need to re-index your data if you change the schema for a particular field.

Status: Fixed » Closed (fixed)

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