# Group By / Filters with UltraSphinx

**URL:** <https://www.ruby-forum.com/t/group-by-filters-with-ultrasphinx/148024>\
**Category:** Rails\
**Created:** [September 8, 2008, 12:56pm UTC](https://www.ruby-forum.com/t/group-by-filters-with-ultrasphinx/148024 "2008-09-08T12:56:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![florian95](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/8baadc/32.png) [@florian95](https://www.ruby-forum.com/u/florian95)\
**Post date:** [September 8, 2008, 12:56pm UTC](https://www.ruby-forum.com/t/group-by-filters-with-ultrasphinx/148024/1 "2008-09-08T12:56:18Z")

</div>

Hi,

I use last version of UltraSphinx but filters dont work…

In my model :  
is\_indexed :fields =\> [‘content’, ‘titre’, ‘created\_at’, {:field =\>  
‘lang’, :facet =\> true, :as =\> ‘lang’}],  
:delta =\> true  
or  
is\_indexed :fields =\> [‘content’, ‘titre’, ‘created\_at’, ‘lang’],  
:delta =\> true

In my controller :  
@search = Ultrasphinx::Search.new(:query =\>  
get\_query\_by\_subject(@subject.id),  
:sort\_mode =\> ‘descending’,  
:sort\_by =\> ‘created\_at’,  
:weights =\> {‘titre’ =\> 5.0,  
‘content’ =\> 2.0},  
:page =\> params[:page] || 1,  
:filters =\> {“lang” =\> “fr”})

Result :  
UsageError : field “lang” is invalid

:conditions =\> {“lang” =\> “fr”} doesnt work too.

I want to filter my results (lang, country, date, etc…) and group by  
title. Ultrasphinx doc doesnt speak about that. Just query work ^^

And I dont really understand what are “facets”. Can you help me  
please ?

Thank you,  
Florian
