I haven't found any way to have proper exposed filters for terms, entity ref, dates, etc. as far as i can see these are all text fields as opposed to their correct widgets such as select lists, date popup, etc.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

doliveros’s picture

I'm having the same issue. I've been looking around, but can't seem to find a viable solution. Any help or direction would be greatly appreciated.

bleen’s picture

Status: Active » Needs review
FileSize
563 bytes

This adds numeric support for filters

bleen’s picture

... This patch includes the meat on the bone too.

bleen’s picture

note that if you have multiple filters set AND at least one of them is numeric AND at least one of the numeric filters uses a range (between, not between, <, <=, >, >=) then you will get an error.

see #2031495: Multiple filters cause errors for more details

undertext’s picture

Here is the patch that adds new filter handler for sm_vid* fields. User can now expose filter as select form. Needs some discussion.

undertext’s picture

Removing dpm() from patch.

undertext’s picture

One more time. Sorry =)

bleen’s picture

These two patches are not mutually exclusive. They should either be combined or considered in two different issues. One adds a generic "numeric" filter (#3) and one adds a filter specific to taxonomy terms(#7)

travismark’s picture

#7 seems working form e but when I click "Allow multiple selections" on the exposed filter..It is no longer giving results...

jarrodirwin’s picture

Attached is an addition to the patch in #7.

I have added the ability to have the exposed filter options limited by the result set. This is a simple checkbox when setting up the exposed filter (Restrict exposed filter values).

Also, it was throwing errors when setting a default value on an exposed filter field. This is due to the #default_value value expecting a string not an array. I have made a tweak to ensure the value is passed as a string.

I know this patch is just for taxonomy terms however the functionality in patch #7 could actually be used to turn any field into a populated select box instead of just targeting sm_vid fields.

jarrodirwin’s picture

Ok, actually attached this time. Notes in #10

memoday’s picture

I am having the same problem, but with interwiki filter module. The exposed text filters are plain text, hence iterwiki filter isn't supported. Which patch would resolve this issue?

BBC’s picture

I was hoping I could use better exposed filters with this module to get some different options. #7 works and looks like a step in the right direction. However, it seems that if you select more than one term from a taxonomy, no results are returned.

a_godin’s picture

For taxonomy terms as checkboxes, there may be a workaround ... it's not really elegant but it works.

Select the 'tm_vid_#_names' field associated with the content you want to search as an exposed filter, and click the option 'Grouped filters'.

In the table below, write the checkbox label you want and the value of the taxonomy term you're looking for. Do that for all the taxonomy terms in the vocabulary. Save the view.

Then, if you have entered more than 4 choices for the taxonomy terms, add the following code in a custom module to transform your exposed taxonomy terms into checkboxes :

function mymodule_form_views_exposed_form_alter(&$form, $form_state, $form_id) {
  switch ($form_id) {  
     case 'views_exposed_form':
     	if($form['#id'] == 'views-exposed-form-recherche-index-solr-page')
     	{
     		$form['tm_vid_4_names']['#type'] = 'checkboxes';
     		$form['tm_vid_5_names']['#type'] = 'checkboxes';
     	}
     	break;
  }
}

Also, apply this patch from views bug report https://www.drupal.org/node/1986306 so you don't get the error "An illegal choice has been detected. Please contact your site administrator." when you navigate through the pager and you haven't checked one of your exposed taxonomy terms : https://www.drupal.org/files/views-fix-exposed-multiple-checkbox-filter-...

Hope this helps someone !

heacu’s picture

Note that #3 is actually broken. It is missing the file: handlers/apachesolr_views_handler_filter_numeric.inc

MiroslavBanov’s picture

Status: Needs review » Needs work

Yes, it appears to modify apachesolr_views_query for some reason, rather than extending the class in a newly created file.

I think though that the idea of #3 is a better candidate for being added to the module, than the next patches.

MiroslavBanov’s picture

Just to clarify my previous post: my issue with the patches #5, #6, #7, #11 is that they target taxonomy term filters specifically.

bleen’s picture

@miroslavbanov .... can we move ahead with #3 than? Is there anything that needs work there?

MiroslavBanov’s picture

@bleen18
There is - see comments #15, #16

mariacha1’s picture

FYI, I moved the work done in #5, 6, 7, and 11 to its own task, since it looks like this task is leaning toward numeric filters.

https://www.drupal.org/node/2394943

surendramohan’s picture

hello guys, any further update on "numeric" support for full text search exposed filter?
The patch suggested at #3 can't be applied at the moment due to the missing handler reported at #15 and #16.

MickL’s picture

Any news on this 2 year old, very important, issue? :(
Or any workaround?

MickL’s picture

Exposed filters select do work for taxonomy terms, when applying following patch:
#2394943: Allow exposed term filters to show as dropdown

But still not working for

  • Content type
  • Regular fields