Hello Sergio!
[...] Due to many records and complex relations, a search in my main
>> table currently takes about 6 seconds, and this will only grow worse.
Have you set index in some columns?
I probably missed something, but it seems you cannot set a FULLTEXT
index in mysql's innodb tables. But as I find the mysql-search to be
rather limited anyway, I didn't really want to invest a lot of time.
I haven't done it before with AS, but it shouldn't be hard to make an action
module to search with some indexer. I have used acts_as_ferret and it adds a
find_with_ferret method to search. That action module should override find_page
method and use own method when a search is requested and overrided method in
other cases.
Currently search modules add a before_filter do_search which set some
conditions to be used later by find_page method in do_list. I could add support
for custom find methods, so your search module would set some variables to be
used by find_page method, and you wouldn't to override find_page.
For example, a ferret_search module could set @find_method to :find_with_ferret
and @find_argument to params[:search], it would set
active_scaffold_config.list.pagination to false when search is done to skip
count query. In this way AS could support plugins like active_scaffold_lucene
and active_scaffold_ferret.
I've started with acts_as_solr, which adds a find_by_solr() method to
affected models. Unfortunately, I have no experience in making action
modules, and neither does google. I do see how do_search sets some
parameters for find_page and how do_list calls it, but I'm lost when it
comes to adjusting this to work with acts_as_solr.
find_by_solr returns e.g. #<ActsAsSolr::SearchResults
@solr_data={:query_time=>1, :total=>8, :docs=>[#<Item1 ...>, <#ItemN
...>], :max_score=>1.6254672}>
I think being able to set a custom find method would help me a lot :)
Also, would it be possible to generate a result page with one AS table
for each Class of search hit? For example, if my search yields two cars
and three people, can AS generate one Cars and one People-Table for
showing the five results?
I'm not sure I'm understanding you, are you talking about searching in
multiple models at the same time?
Exactly.
ben
--
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en.