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

Ticket #1 (closed 1: fixed)

Opened 3 years ago

Last modified 2 years ago

Search across model classes

Reported by: marcora@caltech.edu Assigned to: anonymous
Priority: major Milestone:
Component: 0plugin Version:
Keywords: Cc: leonarde@blader.com

Description

It would be great if, on top of providing ferret search specific to a single model class, there would be way of searching across model classes.

Change History

03/08/06 23:34:00 changed by jk@jkraemer.net

  • owner changed from somebody to anonymous.
  • status changed from new to assigned.

It should be possible to let two models share the same index by giving the same :index_dir value to both calls to acts_as_ferret. Searches would then always be across both models, unless you add a field containing the class name to the index and add that to queries where you only want instances of one class. At the moment there is no support in the plugin to do this class based querying, but it sure is possible to get this working. I'll se if I can implement such a scenario in the demo app the next days.

One also could declare a common base class for the models sharing an index, and call acts_as_ferret there.

Another way is using a MultiSearcher? (a Searcher implementation capable of doing searches across any number of Indexes). Unfortunately the Java Lucene Multisearcher hasn't been integrated into Ferret yet. I'm working on that at the moment.

03/15/06 00:40:35 changed by jk@jkraemer.net

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

this is now implemented, some feedback would be great.

Say you have two classes A and B, you would use acts_as_ferret :store_class_name => true in each of those. To search across both classes, use A.multi_search("query string", [B], options={}), or B.multi_search("query string", [A], options={})

More classes can be added to the second parameter, of course.

10/19/06 05:53:13 changed by henrygdf

  • cc set to leonarde@blader.com.
  • type changed from enhancement to 1.

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