In my content type I have a field of type Date(Unix timestamp). When I add this field to my Search API index and chose type Date on the Fields tab, reindex, and then go to the Facets Tab and try to set the Display Widget to Ranges: (any of them), I receive this error message:

The widget does not support the date query type

Am I going about this in the wrong way? Any suggestions?

Thanks,
Elizabeth

Comments

Anonymous’s picture

Version: 7.x-1.4 » 7.x-1.x-dev

Indeed it does not currently support the date query type. Would also require a widget on the frontend to display date input widgets for the slider.

emettler’s picture

Thanks for the quick reply!

I was looking at the second bullet in the Help so I wasn't sure:

Search ranges
-------------

This module allows you to enable a block with custom ranges options.
Requires Facet API and Search API facetapi integration.

- go to your Search API index > Facets tab
- for any field of type: integer, decimal, float, Unix timestamp
- go to Display Options and choose Display Widget: Min/Max UI Slider
- (optionally) configure name, prefix, suffix
- (optionally) override theme for search-api-ranges-slider.tpl.php
- enable your new Facet block

Anonymous’s picture

You could use a unix timestamp and index it as an integer, but not as a date field.

Anonymous’s picture

Status: Active » Fixed

Reopen if more questions

Status: Fixed » Closed (fixed)

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

tommeir’s picture

Just changed my index type from date to integer for a unix timestamp field. (+swipe and reindexed the site).
when I try to edit the facet settings again I still get the "The widget does not support the date query type" error message.

kostask’s picture

Issue summary: View changes

Same as tommeir I am trying to index the node's date created. I have indexed it as integer and I get the "The widget does not support the date query type" error message.

Strangely enough I am not getting the same error when indexing the node's date changed.

kostask’s picture

Status: Closed (fixed) » Active

I am digging a little bit deeper into this:

The validation function that throws this error is facetapi_facet_display_form_validate in facetapi.admin.inc

When dpming the $query_type of date created and date changed I get date and term respectively.

The only allowed widget type is term in both cases, thus date changed works and date created does not.

My next question is why this happens...

merilainen’s picture

If you add the date to the "query types" in search_api_ranges.module function search_api_ranges_facetapi_widgets()
then you can get the slider working.

'query types' => array('term', 'date'),

Slider is naturally not a very intuitive element for users, but maybe it can be replaced with a datepicker or something in a template.

Why the default "query type" value is "term", I don't know. I thought this module works best with integers and decimals...

suchdavid’s picture

StatusFileSize
new1.3 KB

@mErilainen Thank you for the idea, I made a patch from it.

phily’s picture

Thanks, above patch #10 works.