To edit pages or tickets please login with username/password: aaf/aaf

Ticket #4 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

smart+question

Reported by: ssinghi@kreeti.com Assigned to: jk@jkraemer.net
Priority: 1 Milestone: 1
Component: 1 Version: 1
Keywords: Samuel Cc: Samuel

Description

Are there any plans to support multiple models, one index approach?

Thanks.

Attachments

acts-as-ferret.diff (2.3 kB) - added by ssinghi@kreeti.com on 05/05/06 18:23:01.
Patch file

Change History

03/24/06 22:06:22 changed by tlockney@gmail.com

That was actually in an older version of the plugin. I'm hoping to have some time soon to start hacking on this again and add a configuration option to specify whether to use one index per model or one index for all models.

03/25/06 12:45:55 changed by jk@jkraemer.net

actually, this should be possible by specifying the same :index_dir value to the acts_as_ferret method in each model. The only problem I see is that the automatic initial index creation won't work - it'll only add data from the first model class calling acts_as_ferret for this index directory.

On the other hand, did you try the multi_search method ? It allows to specify additional model classes that use aaf, too, and will run a combined search across all the indexes.

05/05/06 18:22:29 changed by ssinghi@kreeti.com

No, I didn't try the multi_search_method.

But, I have added a hack which introduces a new option and allows storing a single index. Please review it, and I think a polished version of it can be merged with the plugin.

Thanks.

P.S.- For some reason the replies to this ticket are not mailed to me. Some Trac settings might need changing, which will do so.

05/05/06 18:23:01 changed by ssinghi@kreeti.com

  • attachment acts-as-ferret.diff added.

Patch file

05/05/06 18:24:03 changed by anonymous

  • cc set to ssinghi@kreeti.com.

06/07/06 12:36:41 changed by anonymous

  • owner changed from somebody to jk@jkraemer.net.

will look into this soon.

07/10/06 20:01:49 changed by jk

  • status changed from new to closed.
  • resolution set to fixed.

version 0.2.2 now includes this feature.

use

acts_as_ferret :single_index => true

on any model whose data should go into the shared index. Only one shared index is supported, but you can have as many 'standard' indexes in addition to this.

Querying works like this (assuming Model1, Model2 and Model3 all use the shared index):

# query only Model1
Model1.find_by_contents("your query here")

# query both Model1 and Model3
Model1.find_by_contents("your query here", :models => [Model3])
# or:
Model3.find_by_contents("your query here", :models => [Model1])

# query all Models (these are all equivalent)
Model1.find_by_contents("your query here", :models => :all)
Model2.find_by_contents("your query here", :models => :all)
Model3.find_by_contents("your query here", :models => :all)

08/03/06 14:40:54 changed by anonymous

Great resource. Really helpful for understand odbc things.

Thanks.

my email:googlefans@163.com

=============Some my site====================

1.wow gold

2.world of warcraft gold

3.wow gold

08/16/06 08:31:11 changed by Samuel

  • cc changed from ssinghi@kreeti.com to Samuel.
  • component changed from component1 to 1.
  • summary changed from Multiple models, one index to Samuel.
  • priority changed from minor to 1.
  • version changed from 2.0 to 1.
  • milestone changed from milestone1 to 1.
  • keywords set to Samuel.
  • type changed from defect to 1.

Thank you! <a href="http://cakczqin.com/vvpl/dfhe.html">My homepage</a> | <a href="http://albjnmbk.com/wesw/nczu.html">Please visit</a>

10/07/06 20:48:15 changed by Margarett

  • type changed from 1 to defect.
  • summary changed from Samuel to smart+question.

10/08/06 18:57:44 changed by Leonard

10/23/06 10:08:13 changed by Margarett

To edit pages or tickets please login with username/password: aaf/aaf