Finally, the full-text search of ferret was completed. It was not easy to get three full-text searches.
The last two times on my mac, ferret has been confused. The main problem is that it cannot be used for Chinese word segmentation, and it is always crash. I suspect that macos is not very well supported, directly on the server (centos.
Finally, we got it done on the server.
Note: When debugging, disable ferrect-browse, which will prevent reregister class and invalidate some of your updates.
The reason why I haven't done it all the time is that the new api is different from the old one, so I haven't successfully specified customized analyzer. It's too faint. There are almost no examples or articles on the Internet about the new api call method, they are all old, only the latest rdoc.
Another error today is that fields writes field (as if it was copied from the Internet), so the content sometimes can index and sometimes cannot index, and later found that the newly written test code uses filed, the old one is right.
During the test, you must restart ferret_server and then mongrel. Since the ferrect server does not restart register index after startup, it may be registered when mongrel calls act_as_ferrect at startup, but it seems that the ferrect server in the log will know what model you regiester has and how it does it.
Server installation process,
Su-
Gem install ferret
Gem install acts_as_ferret
Run aaf_install in your project directory. If the command cannot be found, run/usr/local/bin/aaf_install.
In this way, the installation is complete, and no other installation is required.
In addition, you must install the word segmentation module rmmseg.
Gem install rmmseg
Test
> Echo "we all like Ruby" | rmmseg
> We all like Ruby.
Configure config/ferrect_server.yml
Add require 'acts _ as_ferret 'to environment. RB'
Add a statement to the model for Index
Class Doc
# Use rmmseg
Ranalyzer = rmmseg: ferret: analyzer. New {| tokenizer |
Ferret: Analysis: lowercasefilter. New (tokenizer)
}
Acts_as_ferret: remote => true,: fields => [: title,: content],: ferret => {: analyzer => ranalyzer} Because content is not a data field, so add method def content # loadContent... end
Resources and Lin
Ferrect
Http://www.davebalmain.com/trac/wiki/FerretOnRails
Act_as_ferret
Http://rm.jkraemer.net/wiki/aaf
Rmmseg
Http://rmmseg.rubyforge.org/
Rdoc
Http://code.jkraemer.net/rdoc/acts_as_ferret/
This article is created by happy writers