[AAF] acts_as_ferret 0.4.0 released


#1

Hi folks!

Just wanted to let you know that I released aaf 0.4.0 on last weekend.

Besides the DRb server it also includes a new lazy loading feature that
lets you do ferret searches without actually loading any records from
the
DB. Useful e.g. for live searches:

model:

class MyModel
acts_as_ferret :fields => { :title => { :store => :yes }, :content =>
{} }
end

controller:

results = MyModel.find_by_contents(query, :lazy => true)

you can use the result objects as you would your AR records, if you
query any attribute not stored in the index, the whole record will be
loaded from the database. So, as long as you only access record.id and
record.title in the example, no DB call will be made.

I’ll post some more documentation about this soon. For now, there’s some
more info about the DRb server on my blog:

http://www.jkraemer.net/2007/3/24/acts_as_ferret-0-4-0-rie


Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
removed_email_address@domain.invalid | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa


#2

cheers for new release
but still got some questions about the mechanizm of aaf
my task of search function has to save the tag words in table just like
a_a_taggable because customer need hot tags function
i wanna know how could i use database instead of file system to store
index or tags


#3

On Mon, Mar 26, 2007 at 10:54:12AM +0200, Jin wrote:

cheers for new release
but still got some questions about the mechanizm of aaf
my task of search function has to save the tag words in table just like
a_a_taggable because customer need hot tags function
i wanna know how could i use database instead of file system to store
index or tags

I’m not sure I understand what you want to achieve, but I’ll try…

if you want to search your tags with ferret, just define a function that
returns a string with all tags of your object, and index that function
by simply specifying it’s name in the field list:

class Model
acts_as_ferret :fields => [ :name, :tag_string ]

def tag_string
tags.map(&:name).join(’ ')
end
end

does that answer your question?

Jens


Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
removed_email_address@domain.invalid | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa


#4

On Tue, Mar 27, 2007 at 04:14:37AM +0200, Jin wrote:

is that useful for this case?
No, I don’t think so. These fields get set by acts_as_ferret for the
results of a query - score is the score as computed by ferret, and rank
the position of the result in the result set, as delivered by ferret
(the order when sorting by rank may be different from the one when
sorting by score if you told ferret to sort results by one or more
fields).

To find out the most used tags I’d probably just use the database, if
you’re using acts_as_taggable or something similar this should be easy
to do.

Jens


Jens Krämer
webit! Gesellschaft für neue Medien mbH
Schnorrstraße 76 | 01069 Dresden
Telefon +49 351 46766-0 | Telefax +49 351 46766-66
removed_email_address@domain.invalid | www.webit.de

Amtsgericht Dresden | HRB 15422
GF Sven Haubold, Hagen Malessa


#5

thank you jens,I saw ur reply both sides
for this hot tags function that is if user search ‘demo1’ with high
frequency
and search ‘pika’ with low frequency then when we wanna make a rank for
them
we can know which is used high frequency
for example,we can list the top ten tags but not all

and i found in our aaf has some specific fields such like
ferret_score,ferret_rank
is that useful for this case?

looking forward to ur response


#6

Jens K. wrote:

On Tue, Mar 27, 2007 at 04:14:37AM +0200, Jin wrote:

is that useful for this case?
No, I don’t think so. These fields get set by acts_as_ferret for the
results of a query - score is the score as computed by ferret, and rank
the position of the result in the result set, as delivered by ferret
(the order when sorting by rank may be different from the one when
sorting by score if you told ferret to sort results by one or more
fields).

To find out the most used tags I’d probably just use the database, if
you’re using acts_as_taggable or something similar this should be easy
to do.

Jens

Thank you,Jens
After gaining some I think i have got the way to the final solution
tomorrow our project will kick off,thank you
I will make a strong search function with ur help
:slight_smile:


#7

sorry
I was still gainning in the mud of search
because now i create 3 table
members,tags,taggings

these last two tables were the nearly same as aataggable,i use them to
store
specific information
the members table i use it for storing member information

the keywords is come from the page only stored in the tag table

so that mean keywords is not stored in the member fields but only in the
tag table

if it is in sql we found tag first then taggings then related records

1 requirement really chanllenged me just for user need display search
result just like this way

if it is a,b,c these 3 words
then the result must be
records which are satified condition

  1. a and b and c first
    2.then a and b, b and c, a and c–except the records are existed in
    above
    3.the last are a, b, c–except the records are existed in above

any suggestion?