Google Groups Home
Help | Sign in
Extending lovd search
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all
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
AssimovT  
View profile
 More options Jul 18, 6:45 am
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.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steven A Bristol  
View profile
 More options Jul 21, 10:11 am
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

Hi Tair,

Try http://projects.jkraemer.net/acts_as_ferret/ for the ferret docs.

steve


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sazima  
View profile
 More options Jul 24, 12:30 pm
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:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
AssimovT  
View profile
 More options Jul 28, 8:09 am
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:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Sazima  
View profile
 More options Jul 29, 10:30 am
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:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google