The group you are posting to is a
Usenet group . Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
From:
AssimovT <assim... @gmail.com>
Date: Fri, 18 Jul 2008 03:45:44 -0700 (PDT)
Local: Fri, Jul 18 2008 6:45 am
Subject: Extending lovd search
HI!
Does anyone know how to extend the search fields in lovd?
For instance I would like to define extra conditions in
find_by_contents in profile model, however seems they dont work.
I tried it like this for test purposes and havent seen any SQL queries
in logs:
Profile.find_by_contents q, :limit=>all, :conditions => ['user_id =
1']
Thanks for all help,
Tair.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
"Steven A Bristol" <st... @lesseverything.com>
Date: Mon, 21 Jul 2008 10:11:32 -0400
Local: Mon, Jul 21 2008 10:11 am
Subject: Re: Extending lovd search
On Fri, Jul 18, 2008 at 6:45 AM, AssimovT <assim
... @gmail.com> wrote:
> HI!
> Does anyone know how to extend the search fields in lovd?
> For instance I would like to define extra conditions in > find_by_contents in profile model, however seems they dont work.
> I tried it like this for test purposes and havent seen any SQL queries > in logs:
> Profile.find_by_contents q, :limit=>all, :conditions => ['user_id = > 1']
> Thanks for all help,
> Tair.
Hi Tair,
Try http://projects.jkraemer.net/acts_as_ferret/ for the ferret docs.
steve
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Sazima <rsaz... @gmail.com>
Date: Thu, 24 Jul 2008 09:30:34 -0700 (PDT)
Local: Thurs, Jul 24 2008 12:30 pm
Subject: Re: Extending lovd search
Hey Tair,
I managed to do something similar. In profile.rb:
def self.search query = '', options = {}
query ||= ''
q = '*' + query.gsub(/[^\w\s-]/, '').gsub(' ', '* *') + '*'
options.each {|key, value| q += " #{key}:#{value}"}
# arr = find_by_contents q, :limit=>:all
arr = find_by_contents q, {}, {:conditions => "profiles.is_active
= 1"}
logger.debug arr.inspect
arr
end
Cheers, Sazima
On Jul 18, 7:45 am, AssimovT <assim... @gmail.com> wrote:
> HI!
> Does anyone know how to extend the search fields in lovd?
> For instance I would like to define extra conditions in
> find_by_contents in profile model, however seems they dont work.
> I tried it like this for test purposes and havent seen any SQL queries
> in logs:
> Profile.find_by_contents q, :limit=>all, :conditions => ['user_id =
> 1']
> Thanks for all help,
> Tair.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
AssimovT <assim... @gmail.com>
Date: Mon, 28 Jul 2008 05:09:41 -0700 (PDT)
Local: Mon, Jul 28 2008 8:09 am
Subject: Re: Extending lovd search
Sazima, thanks for reply!
I am trying with the following lines:
#options.each {|key, value| q += " #{key}:#{value}"}
arr = Profile.find_by_contents q, {}, {:conditions=>[where.join(" AND
"), options]}
Basically I feed the options from the form and make a query together
with "q" parameter.
However I get the following error:
wrong number of bind variables (2 for 1) in: profiles.id in (?) and
user_id != 2
Any ideas?
Thanks,
Tair
wrong number of bind variables (2 for 1) in: profiles.id in (?) and
user_id != 2
On Jul 24, 7:30 pm, Sazima <rsaz... @gmail.com> wrote:
> Hey Tair,
> I managed to do something similar. In profile.rb:
> def self.search query = '', options = {}
> query ||= ''
> q = '*' + query.gsub(/[^\w\s-]/, '').gsub(' ', '* *') + '*'
> options.each {|key, value| q += " #{key}:#{value}"}
> # arr = find_by_contents q, :limit=>:all
> arr = find_by_contents q, {}, {:conditions => "profiles.is_active
> = 1"}
> logger.debug arr.inspect
> arr
> end
> Cheers, Sazima
> On Jul 18, 7:45 am, AssimovT <assim... @gmail.com> wrote:
> > HI!
> > Does anyone know how to extend the search fields in lovd?
> > For instance I would like to define extra conditions in
> > find_by_contents in profile model, however seems they dont work.
> > I tried it like this for test purposes and havent seen any SQL queries
> > in logs:
> > Profile.find_by_contents q, :limit=>all, :conditions => ['user_id =
> > 1']
> > Thanks for all help,
> > Tair.
You must
Sign in before you can post messages.
You do not have the permission required to post.
From:
Sazima <rsaz... @gmail.com>
Date: Tue, 29 Jul 2008 07:30:37 -0700 (PDT)
Local: Tues, Jul 29 2008 10:30 am
Subject: Re: Extending lovd search
Hi Tair,
I couldn't really check your code working, but from what I understand
about the use of :conditions, you don't need to include the " AND ".
Just pass your SQL conditions and they will be added to the current
query. Sure, if there is more than 1 condition, use must use AND
between them.
Anyway, find_by_contents (alias for find_with_ferret) does some
manipulation with the conditions. I only managed to get it to work
using a textual condition...
Cheers, SAzima
On Jul 28, 9:09 am, AssimovT <assim... @gmail.com> wrote:
> Sazima, thanks for reply!
> I am trying with the following lines:
> #options.each {|key, value| q += " #{key}:#{value}"}
> arr = Profile.find_by_contents q, {}, {:conditions=>[where.join(" AND
> "), options]}
> Basically I feed the options from the form and make a query together
> with "q" parameter.
> However I get the following error:
> wrong number of bind variables (2 for 1) in: profiles.id in (?) and
> user_id != 2
> Any ideas?
> Thanks,
> Tair
> wrong number of bind variables (2 for 1) in: profiles.id in (?) and
> user_id != 2
> On Jul 24, 7:30 pm, Sazima <rsaz... @gmail.com> wrote:
> > Hey Tair,
> > I managed to do something similar. In profile.rb:
> > def self.search query = '', options = {}
> > query ||= ''
> > q = '*' + query.gsub(/[^\w\s-]/, '').gsub(' ', '* *') + '*'
> > options.each {|key, value| q += " #{key}:#{value}"}
> > # arr = find_by_contents q, :limit=>:all
> > arr = find_by_contents q, {}, {:conditions => "profiles.is_active
> > = 1"}
> > logger.debug arr.inspect
> > arr
> > end
> > Cheers, Sazima
> > On Jul 18, 7:45 am, AssimovT <assim... @gmail.com> wrote:
> > > HI!
> > > Does anyone know how to extend the search fields in lovd?
> > > For instance I would like to define extra conditions in
> > > find_by_contents in profile model, however seems they dont work.
> > > I tried it like this for test purposes and havent seen any SQL queries
> > > in logs:
> > > Profile.find_by_contents q, :limit=>all, :conditions => ['user_id =
> > > 1']
> > > Thanks for all help,
> > > Tair.
You must
Sign in before you can post messages.
You do not have the permission required to post.