Jason Fox
2008-Sep-16 20:52 UTC
Ultrasphinx - field is invalid - can''t get :filters to work
I am having trouble getting the Ultrasphinx plug-in to filter search
results using the :filters parameter; searches that use the :query
parameter, however, work just fine. Every time I run a search using the
:filters parameter I receive the following error:
Ultrasphinx::UsageError:field "xxx" is invalid
Here is how my model is configured:
class Product
is_indexed :fields => [ "code" ]
end
And here is an example search that fails with the above exception:
search = Ultrasphinx::Search.new(:filters => {:code => "test"})
search.run
And an example of a search that works just fine:
search = Ultrasphinx::Search.new(:query => "code:test")
search.run
I must be missing something simple. Any help would be greatly
appreciated. Thanks in advance.
Regards,
Jason
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Stanislav Bozhkov
2009-Jan-14 16:51 UTC
Re: Ultrasphinx - field is invalid - can''t get :filters to work
I have exactly the same problem. Does anyone knows for a solution? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jason Fox
2009-Jan-14 16:56 UTC
Re: Ultrasphinx - field is invalid - can''t get :filters to work
It''s been a while, but, I believe I discovered that :filters are only applicable to association FK columns. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Stanislav Bozhkov
2009-Jan-14 18:57 UTC
Re: Ultrasphinx - field is invalid - can''t get :filters to work
I can not make it work in any way. I''m dealing with this a whole
workday
today.
So, I have tried all of these setups:
----------------
class Video < ActiveRecord::Base
...
belongs_to :topic
...
is_indexed :fields =>
[''title'',''description'',''created_at''],
:include => [
{:association_name => ''topic'', :field =>
''id'', :as =>
''topic_id''}
],
:delta => {:field => ''created_at''}
...
end
@sphinx = Ultrasphinx::Search.new(:query => "london", :class_names
=>
"Video", :filters => {:topic_id => 17} ).run.total_entries
Ultrasphinx::UsageError: field "topic_id" is invalid
---------------
is_indexed :fields =>
[''title'',''description'',''created_at'',''topic_id''],
@sphinx = Ultrasphinx::Search.new(:query => "london", :class_names
=>
"Video", :filters => {:topic_id => 17} ).run.total_entries
Ultrasphinx::UsageError: field "topic_id" is invalid
--------------
is_indexed :fields =>
[''title'',''description'',''created_at''],
:include => [
{:association_name => ''topic'', :field =>
''id'', :as =>
''topic_id2''}
@sphinx = Ultrasphinx::Search.new(:query => "london", :class_names
=>
"Video", :filters => {:topic_id2 => 17} ).run.total_entries
Ultrasphinx::UsageError: field "topic_id2" is invalid
----------
After each change of configuration I run
rake ultrasphinx:configure
rake ultrasphinx:index
No real results. I just can''t make it work with :filters . I''m
using
ultrasphinx 1.11 .
Every idea and help is highly appreciated.
10x in advance.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Stanislav Bozhkov
2009-Jan-22 08:51 UTC
Re: Ultrasphinx - field is invalid - can''t get :filters to work
I had an advice from the Ultrasphinx official forum to try with aliasing
the topic_id as an unique id name. So I tried this configuration:
is_indexed :fields =>
[''title'',''description'',''created_at'',
{:field => ''topic_id'', :as =>
''video_topic_id''}],
:delta => {:field => ''created_at''}
(topic_id is an integer column that is part of Video model)
After that running: rake ulrasphinx:configure; rake ultrasphinx:index;
However the same error occurs:
------------------------------->> Ultrasphinx::Search.new(:query => "london", :class_names
=> "Video" ).run.total_entries
=> 1>> Ultrasphinx::Search.new(:query => "london", :class_names
=> "Video", :filters => {:video_topic_id => 17}
).run.total_entries
Ultrasphinx::UsageError: field "video_topic_id" is invalid
-------------------------------
In case that there''s someone who has successfully run a similar task,
share your configurations, please.
Stanislav Bozhkov wrote:> I can not make it work in any way. I''m dealing with this a whole
workday
> today.
>
> So, I have tried all of these setups:
> ----------------
> class Video < ActiveRecord::Base
> ...
> belongs_to :topic
> ...
> is_indexed :fields =>
[''title'',''description'',''created_at''],
> :include => [
> {:association_name => ''topic'', :field
=> ''id'', :as =>
> ''topic_id''}
> ],
> :delta => {:field => ''created_at''}
> ...
> end
>
> @sphinx = Ultrasphinx::Search.new(:query => "london",
:class_names =>
> "Video", :filters => {:topic_id => 17} ).run.total_entries
>
> Ultrasphinx::UsageError: field "topic_id" is invalid
>
> ---------------
> is_indexed :fields =>
[''title'',''description'',''created_at'',''topic_id''],
>
> @sphinx = Ultrasphinx::Search.new(:query => "london",
:class_names =>
> "Video", :filters => {:topic_id => 17} ).run.total_entries
>
> Ultrasphinx::UsageError: field "topic_id" is invalid
>
> --------------
> is_indexed :fields =>
[''title'',''description'',''created_at''],
> :include => [
> {:association_name => ''topic'', :field
=> ''id'', :as =>
> ''topic_id2''}
>
>
> @sphinx = Ultrasphinx::Search.new(:query => "london",
:class_names =>
> "Video", :filters => {:topic_id2 => 17} ).run.total_entries
>
> Ultrasphinx::UsageError: field "topic_id2" is invalid
>
> ----------
>
> After each change of configuration I run
> rake ultrasphinx:configure
> rake ultrasphinx:index
>
> No real results. I just can''t make it work with :filters .
I''m using
> ultrasphinx 1.11 .
>
> Every idea and help is highly appreciated.
>
> 10x in advance.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Mrknife
2009-Feb-10 21:14 UTC
Re: Ultrasphinx - field is invalid - can''t get :filters to work
I was able to get a ''filter'' to work...
basically I used the :concatenate option
is_indexed :fields =>
[''title'',''description'',''created_at''],
:concatenate => [ {:fields =>
[''topic_id''], :as
=> ''video_topic_id''} ],
:delta => {:field => ''created_at''}
Then I was able to run this.
Ultrasphinx::Search.new(:query => "london video_topic_id:
17", :class_names => "Video")
This is in no way ideal...
But I did manage to return the result set I wanted.
On Jan 22, 3:51 am, Stanislav Bozhkov <rails-mailing-l...@andreas-
s.net> wrote:> I had an advice from the Ultrasphinx official forum to try with aliasing
> the topic_id as an unique id name. So I tried this configuration:
>
> is_indexed :fields =>
[''title'',''description'',''created_at'',
> {:field => ''topic_id'', :as =>
''video_topic_id''}],
> :delta => {:field => ''created_at''}
>
> (topic_id is an integer column that is part of Video model)
>
> After that running: rake ulrasphinx:configure; rake ultrasphinx:index;
>
> However the same error occurs:
> ------------------------------->> Ultrasphinx::Search.new(:query
=> "london", :class_names => "Video"
).run.total_entries
> => 1
> >> Ultrasphinx::Search.new(:query => "london",
:class_names => "Video", :filters => {:video_topic_id => 17}
).run.total_entries
>
> Ultrasphinx::UsageError: field "video_topic_id" is invalid
> -------------------------------
>
> In case that there''s someone who has successfully run a similar
task,
> share your configurations, please.
>
>
>
> Stanislav Bozhkov wrote:
> > I can not make it work in any way. I''m dealing with this a
whole workday
> > today.
>
> > So, I have tried all of these setups:
> > ----------------
> > class Video < ActiveRecord::Base
> > ...
> > belongs_to :topic
> > ...
> > is_indexed :fields =>
[''title'',''description'',''created_at''],
> > :include => [
> > {:association_name => ''topic'',
:field => ''id'', :as =>
> > ''topic_id''}
> > ],
> > :delta => {:field =>
''created_at''}
> > ...
> > end
>
> > @sphinx = Ultrasphinx::Search.new(:query => "london",
:class_names =>
> > "Video", :filters => {:topic_id => 17}
).run.total_entries
>
> > Ultrasphinx::UsageError: field "topic_id" is invalid
>
> > ---------------
> > is_indexed :fields =>
[''title'',''description'',''created_at'',''topic_id''],
>
> > @sphinx = Ultrasphinx::Search.new(:query => "london",
:class_names =>
> > "Video", :filters => {:topic_id => 17}
).run.total_entries
>
> > Ultrasphinx::UsageError: field "topic_id" is invalid
>
> > --------------
> > is_indexed :fields =>
[''title'',''description'',''created_at''],
> > :include => [
> > {:association_name => ''topic'',
:field => ''id'', :as =>
> > ''topic_id2''}
>
> > @sphinx = Ultrasphinx::Search.new(:query => "london",
:class_names =>
> > "Video", :filters => {:topic_id2 => 17}
).run.total_entries
>
> > Ultrasphinx::UsageError: field "topic_id2" is invalid
>
> > ----------
>
> > After each change of configuration I run
> > rake ultrasphinx:configure
> > rake ultrasphinx:index
>
> > No real results. I just can''t make it work with :filters .
I''m using
> > ultrasphinx 1.11 .
>
> > Every idea and help is highly appreciated.
>
> > 10x in advance.
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Stanislav Bozhkov
2009-Feb-11 09:21 UTC
Re: Ultrasphinx - field is invalid - can''t get :filters to work
Thank you. I''ll test your suggestion as soon as possible. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---