Hi I use acts_as_ferret on an app that is in Danish and English. In Danish english words like "and" and "under" has meaning. Is it possible to make ferret search for these words? As it is now a seach for "under" returns nothing even-though I know the word is present in the index. Cheers Mattias
On Thu, Mar 22, 2007 at 04:29:13PM +0100, Mattias Bodlund wrote:> Hi > > I use acts_as_ferret on an app that is in Danish and English. In > Danish english words like "and" and "under" has meaning. Is it > possible to make ferret search for these words? As it is now a seach > for "under" returns nothing even-though I know the word is present in > the index.construct your own StandardAnalyzer and specify your custom stop word list (or an empty array for no stop words at all). See http://ferret.davebalmain.com/api/classes/Ferret/Analysis/StandardAnalyzer.html With aaf you can specify that analyzer like that: class MyModel acts_as_ferret( { :fields => { ... } }, { :analyzer => Ferret::Analysis::StandardAnalyzer.new([]) } ) ... end note the analyzer option goes into the second argument hash (where all options go that are handed through to ferret''s Ferret::Index::Index instance). 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 kraemer at webit.de | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold, Hagen Malessa
On Thu, Mar 22, 2007 at 05:05:12PM +0100, Jens Kraemer wrote:> On Thu, Mar 22, 2007 at 04:29:13PM +0100, Mattias Bodlund wrote: > > Hi > > > > I use acts_as_ferret on an app that is in Danish and English. In > > Danish english words like "and" and "under" has meaning. Is it > > possible to make ferret search for these words? As it is now a seach > > for "under" returns nothing even-though I know the word is present in > > the index. > > construct your own StandardAnalyzer and specify your custom stop word list (or > an empty array for no stop words at all). > > See > http://ferret.davebalmain.com/api/classes/Ferret/Analysis/StandardAnalyzer.html > > With aaf you can specify that analyzer like that: > > class MyModel > acts_as_ferret( { :fields => { ... } }, { :analyzer => Ferret::Analysis::StandardAnalyzer.new([]) } ) > ... > > end > > note the analyzer option goes into the second argument hash (where all > options go that are handed through to ferret''s Ferret::Index::Index > instance).one more note - you need to rebuild your index after changing analyzers. 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 kraemer at webit.de | www.webit.de Amtsgericht Dresden | HRB 15422 GF Sven Haubold, Hagen Malessa
On 22/03/2007, at 17.08, Jens Kraemer wrote:> On Thu, Mar 22, 2007 at 05:05:12PM +0100, Jens Kraemer wrote: >> On Thu, Mar 22, 2007 at 04:29:13PM +0100, Mattias Bodlund wrote: >>> Hi >>> >>> I use acts_as_ferret on an app that is in Danish and English. In >>> Danish english words like "and" and "under" has meaning. Is it >>> possible to make ferret search for these words? As it is now a seach >>> for "under" returns nothing even-though I know the word is >>> present in >>> the index. >> >> construct your own StandardAnalyzer and specify your custom stop >> word list (or >> an empty array for no stop words at all). >> >> See >> http://ferret.davebalmain.com/api/classes/Ferret/Analysis/ >> StandardAnalyzer.html >> >> With aaf you can specify that analyzer like that: >> >> class MyModel >> acts_as_ferret( { :fields => { ... } }, { :analyzer => >> Ferret::Analysis::StandardAnalyzer.new([]) } ) >> ... >> >> end >> >> note the analyzer option goes into the second argument hash (where >> all >> options go that are handed through to ferret''s Ferret::Index::Index >> instance). > > one more note - you need to rebuild your index after changing > analyzers. > > Jens >Thanks a lot Jens. I''ll integrate and then reindex the thing. mattias