From samuelgiffney at gmail.com Sun Dec 2 00:19:33 2007 From: samuelgiffney at gmail.com (Sam Giffney) Date: Sun, 2 Dec 2007 06:19:33 +0100 Subject: [Ferret-talk] solaris SMF to start ferret drb server In-Reply-To: <142002c4b2049071cb5011b18af10d22@ruby-forum.com> References: <142002c4b2049071cb5011b18af10d22@ruby-forum.com> Message-ID: Jesse Grosjean wrote: > I'm trying to write a solaris SMF file to launch the ferret drb server. Hmm, I think I've hit a similar problem. I've just upgraded to the latest ferret trunk from an old aaf stable where the script/ferret_start and script/ferret_stop scripts were still in use. now if I call the old script... RAILS_ENV=production script/ferret_start script/ferret_start:25:in `load': wrong number of arguments (0 for 1) (ArgumentError) from script/ferret_start:25 but if I call the new script... ruby script/ferret_server -e production stop no such file to load -- /usr/bin/../config/environment so I am confused! Pretty sure the latest aaf drb server is not compatible with the info in http://projects.jkraemer.net/acts_as_ferret/wiki/DrbServer . Happy to help edit that when we figure this out. Sam -- Posted via http://www.ruby-forum.com/. From jk at jkraemer.net Sun Dec 2 08:52:30 2007 From: jk at jkraemer.net (Jens Kraemer) Date: Sun, 2 Dec 2007 14:52:30 +0100 Subject: [Ferret-talk] solaris SMF to start ferret drb server In-Reply-To: References: <142002c4b2049071cb5011b18af10d22@ruby-forum.com> Message-ID: <20071202135230.GM30296@thunder.jkraemer.net> Hi! On Sun, Dec 02, 2007 at 06:19:33AM +0100, Sam Giffney wrote: > Jesse Grosjean wrote: > > I'm trying to write a solaris SMF file to launch the ferret drb server. > > Hmm, I think I've hit a similar problem. I've just upgraded to the > latest ferret trunk from an old aaf stable where the script/ferret_start > and script/ferret_stop scripts were still in use. > > now if I call the old script... > > RAILS_ENV=production script/ferret_start > script/ferret_start:25:in `load': wrong number of arguments (0 for 1) > (ArgumentError) > from script/ferret_start:25 > > but if I call the new script... > > ruby script/ferret_server -e production stop > no such file to load -- /usr/bin/../config/environment yeah, this happens because I use ENV['_'] to determine the location of the Rails environment file. When calling the script as argument to the ruby binary, ENV['_'] points there and not to the script. So if you make script/ferret_server executable and ensure the first line points to your ruby binary it should work. Or edit aaf's server_manager.rb and use __FILE__ instead of ENV['_'] - this will work as long as you have aaf installed in your project and don't use the acts_as_ferret gem. I'll happily apply a patch which will help get around these annoying problems and make the script work under all circumstances (using aaf gem or not, calling with explicit Ruby interpreter or not). Cheers, Jens -- Jens Kr?mer http://www.jkraemer.net/ - Blog http://www.omdb.org/ - The new free film database From lists at kikobu.com Sun Dec 2 16:22:25 2007 From: lists at kikobu.com (Morten) Date: Sun, 2 Dec 2007 21:22:25 +0000 (UTC) Subject: [Ferret-talk] =?utf-8?q?total=5Fhits_and_conditions?= Message-ID: Hi. I'm running 0.11.4. The problem I'm having, appears to have been solved before according to various posts I googled up, but possibly the fix got removed from 0.11.3 to 0.11.4? re = Entry.multi_search('service', [Ticket], options, {}) re.size 620 re.total_hits 620 Now add conditions: re = Entry.multi_search('service', [Ticket], options, {:conditions => "account_id=#{u.account_id}"}) re.size 5 re.total_hits 620 Looks broken to me. Br, Morten From kraemer at webit.de Mon Dec 3 04:03:36 2007 From: kraemer at webit.de (Jens Kraemer) Date: Mon, 3 Dec 2007 10:03:36 +0100 Subject: [Ferret-talk] total_hits and conditions In-Reply-To: References: Message-ID: <20071203090336.GL17718@cordoba.webit.de> Hi, most probably this is a bug in acts_as_ferret, not of Ferret itself. Which version of aaf are you using? Could you please try aaf trunk? Cheers, Jens On Sun, Dec 02, 2007 at 09:22:25PM +0000, Morten wrote: > > Hi. I'm running 0.11.4. The problem I'm having, appears to have been solved > before according to various posts I googled up, but possibly the fix got removed > from 0.11.3 to 0.11.4? > > re = Entry.multi_search('service', [Ticket], options, {}) > re.size > 620 > re.total_hits > 620 > > Now add conditions: > > re = Entry.multi_search('service', [Ticket], options, {:conditions => > "account_id=#{u.account_id}"}) > re.size > 5 > re.total_hits > 620 > > Looks broken to me. > > Br, > > Morten > > > > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk > -- 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 From marc.s.galbraith at gmail.com Mon Dec 3 04:53:05 2007 From: marc.s.galbraith at gmail.com (Marc Galbraith) Date: Mon, 3 Dec 2007 20:53:05 +1100 Subject: [Ferret-talk] 64-bit Ubuntu 7.10 Message-ID: HI Guys, I am trying to install ferret as a gem 'sudo gem install ferret' and it is failing to make the native libraries, I am using the 64 bit version of Ubuntu 7.10 Here is the first the first 30 lines or so, any hints, I know it is probably some sort of 32 bit v 64 bit problem?? ---------------------- Building native extensions. This could take a while... ERROR: While executing gem ... (Gem::Installer::ExtensionBuildError) ERROR: Failed to build gem native extension. ruby extconf.rb install ferret creating Makefile make cc -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/1.8/x86_64-linux -I. -fPIC -fno-strict-aliasing -g -O2 -fPIC -D_FILE_OFFSET_BITS=64 -c posh.c cc -I. -I/usr/lib/ruby/1.8/x86_64-linux -I/usr/lib/ruby/1.8/x86_64-linux -I. -fPIC -fno-strict-aliasing -g -O2 -fPIC -D_FILE_OFFSET_BITS=64 -c q_phrase.c q_phrase.c:1:20: error: string.h: No such file or directory In file included from /usr/lib/gcc/x86_64-linux-gnu/4.1.3/include/syslimits.h:7, from /usr/lib/gcc/x86_64-linux-gnu/4.1.3/include/limits.h:11, from q_phrase.c:2: /usr/lib/gcc/x86_64-linux-gnu/4.1.3/include/limits.h:122:61: error: limits.h: No such file or directory In file included from global.h:4, from index.h:4, from search.h:8, from q_phrase.c:3: config.h:4:23: error: sys/types.h: No such file or directory In file included from global.h:5, from index.h:4, from search.h:8, from q_phrase.c:3: except.h:73:20: error: setjmp.h: No such file or directory In file included from global.h:5, from index.h:4, from search.h:8, from q_phrase.c:3: except.h:97: error: expected specifier-qualifier-list before 'jmp_buf' In file included from lang.h:7, from global.h:6, from index.h:4, from search.h:8, from q_phrase.c:3: /usr/lib/ruby/1.8/x86_64-linux/ruby.h:40:21: error: stdlib.h: No such file or directory /usr/lib/ruby/1.8/x86_64-linux/ruby.h:54:19: error: stdio.h: No such file or directory /usr/lib/ruby/1.8/x86_64-linux/ruby.h:71:20: error: alloca.h: No such file or directory ------------- Regards, Marc. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20071203/31c4642e/attachment.html From shane.hanna at gmail.com Wed Dec 5 18:47:09 2007 From: shane.hanna at gmail.com (Shane Hanna) Date: Thu, 6 Dec 2007 10:47:09 +1100 Subject: [Ferret-talk] Term frequency doesn't decrement after document is deleted. Message-ID: <869ada6e0712051547p6c787247gbf473fd6abf441b9@mail.gmail.com> Hey all, The frequency count returned by my ferret reader doesn't decrement after I remove a documents with those terms. Using the example from http://ferret.davebalmain.com/api/classes/Ferret/Index/TermEnum.html the frequency increments after a document is added but stays the same after a document is deleted. index.reader.terms(:tags).each do |term, freq| "#{term} appears #{freq} times" end If I iterate through each document matched by terms_for I get the correct frequency but I assume at a higher performance cost. index.reader.terms(:tags).each do |term| freq = index.reader.terms_for(:tags, term).each{} "#{term} appears #{freq} times" end I'm wondering if I'm plain just doing something wrong. I'm running the gem version 0.11.6 (ruby) on i686-darwin9.1.0 and I can provide a unit test if it'd help. Cheers, Shane. From jk at jkraemer.net Wed Dec 5 19:05:41 2007 From: jk at jkraemer.net (Jens Kraemer) Date: Thu, 6 Dec 2007 01:05:41 +0100 Subject: [Ferret-talk] Term frequency doesn't decrement after document is deleted. In-Reply-To: <869ada6e0712051547p6c787247gbf473fd6abf441b9@mail.gmail.com> References: <869ada6e0712051547p6c787247gbf473fd6abf441b9@mail.gmail.com> Message-ID: <20071206000541.GD30296@thunder.jkraemer.net> Hi! I'm not sure if this is the intended behaviour, so it might be a Ferret bug indeed. However you should get the correct term frequency again after optimizing the index. Cheers, Jens On Thu, Dec 06, 2007 at 10:47:09AM +1100, Shane Hanna wrote: > Hey all, > > The frequency count returned by my ferret reader doesn't decrement > after I remove a documents with those terms. Using the example from > http://ferret.davebalmain.com/api/classes/Ferret/Index/TermEnum.html > the frequency increments after a document is added but stays the same > after a document is deleted. > > index.reader.terms(:tags).each do |term, freq| > "#{term} appears #{freq} times" > end > > If I iterate through each document matched by terms_for I get the > correct frequency but I assume at a higher performance cost. > > index.reader.terms(:tags).each do |term| > freq = index.reader.terms_for(:tags, term).each{} > "#{term} appears #{freq} times" > end > > I'm wondering if I'm plain just doing something wrong. I'm running the > gem version 0.11.6 (ruby) on i686-darwin9.1.0 and I can provide a unit > test if it'd help. > > Cheers, > Shane. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk > -- Jens Kr?mer http://www.jkraemer.net/ - Blog http://www.omdb.org/ - The new free film database From julioody at gmail.com Wed Dec 5 19:23:54 2007 From: julioody at gmail.com (Julio Cesar Ody) Date: Thu, 6 Dec 2007 11:23:54 +1100 Subject: [Ferret-talk] Term frequency doesn't decrement after document is deleted. In-Reply-To: <20071206000541.GD30296@thunder.jkraemer.net> References: <869ada6e0712051547p6c787247gbf473fd6abf441b9@mail.gmail.com> <20071206000541.GD30296@thunder.jkraemer.net> Message-ID: Indeed looks like a bug. I've gone through a small hell recently because of a similar issue =) index.size also suffers from the same problem. Apparently values for num_docs (or you tell me what it is exactly if I'm getting it wrong) get cached in IndexReader and when you call it, it returns values that are not necessarily consistent with what's actually in the index. Also in this same situation, index.optimize before index.size solves the problem. On Dec 6, 2007 11:05 AM, Jens Kraemer wrote: > Hi! > > I'm not sure if this is the intended behaviour, so it might be a Ferret > bug indeed. > > However you should get the correct term frequency again after > optimizing the index. > > Cheers, > Jens > > > On Thu, Dec 06, 2007 at 10:47:09AM +1100, Shane Hanna wrote: > > Hey all, > > > > The frequency count returned by my ferret reader doesn't decrement > > after I remove a documents with those terms. Using the example from > > http://ferret.davebalmain.com/api/classes/Ferret/Index/TermEnum.html > > the frequency increments after a document is added but stays the same > > after a document is deleted. > > > > index.reader.terms(:tags).each do |term, freq| > > "#{term} appears #{freq} times" > > end > > > > If I iterate through each document matched by terms_for I get the > > correct frequency but I assume at a higher performance cost. > > > > index.reader.terms(:tags).each do |term| > > freq = index.reader.terms_for(:tags, term).each{} > > "#{term} appears #{freq} times" > > end > > > > I'm wondering if I'm plain just doing something wrong. I'm running the > > gem version 0.11.6 (ruby) on i686-darwin9.1.0 and I can provide a unit > > test if it'd help. > > > > Cheers, > > Shane. > > _______________________________________________ > > Ferret-talk mailing list > > Ferret-talk at rubyforge.org > > http://rubyforge.org/mailman/listinfo/ferret-talk > > > > -- > Jens Kr?mer > http://www.jkraemer.net/ - Blog > http://www.omdb.org/ - The new free film database > > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk > From pierre at baillet.name Thu Dec 6 06:24:43 2007 From: pierre at baillet.name (Pierre Baillet) Date: Thu, 6 Dec 2007 12:24:43 +0100 Subject: [Ferret-talk] Ferret in ruby1.9 Message-ID: <6205b42d0712060324t3ade1ebbk7f36e3550d3091c9@mail.gmail.com> Hi all, I'm brand new to this ml so pardon my rudeness. I'm currently trying to do some tests with ruby pre-1.9 to see how cool it is. Unfortunately, due to changes in the internal ruby API, the ferret extension no longer compiles so i'm simply unable to use it. I know this will add some more burden to the developers, but I wondered if this could be interesting to have the extension working in ruby1.9 too... Cheers, -- Pierre Baillet -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20071206/18017483/attachment-0001.html From john at digitalpulp.com Tue Dec 11 13:32:22 2007 From: john at digitalpulp.com (John Bachir) Date: Tue, 11 Dec 2007 13:32:22 -0500 Subject: [Ferret-talk] My AAF tweaks In-Reply-To: References: Message-ID: On Nov 18, 2007, at 7:33 PM, Alex Neth wrote: > I have had to fix a few issues with AAF in order to get it working > well for myself in a production environment. I'm using the latest > "release" version which is 0.4.1: Thanks for sharing Alex. It seems like all of the issues you described are pretty significant and would affect most users. Did you ever get around to submitting a patch? If it's working for you in production then the patch is good enough to at least start some discussion. John From john at digitalpulp.com Tue Dec 11 15:38:23 2007 From: john at digitalpulp.com (John Bachir) Date: Tue, 11 Dec 2007 15:38:23 -0500 Subject: [Ferret-talk] Unified ferret_start and ferret_stop In-Reply-To: <20071107200552.GB18363@thunder.jkraemer.net> References: <20071107200552.GB18363@thunder.jkraemer.net> Message-ID: On Nov 7, 2007, at 3:05 PM, Jens Kraemer wrote: > works like a charm and looks great :-) > > Just merged this into trunk. Here's an update to the capistrano tasks to work with the new script: http://projects.jkraemer.net/acts_as_ferret/ticket/190 Cheers, John From san.r.patil at gmail.com Wed Dec 12 23:37:13 2007 From: san.r.patil at gmail.com (Santosh R Patil) Date: Thu, 13 Dec 2007 10:07:13 +0530 Subject: [Ferret-talk] help on act_as_ferret Message-ID: <3c459f6d0712122037u3f80a621vdee0934915e94908@mail.gmail.com> Hi, My name is santoshkumar r Patil. I am using ferret for searching. I am using mult_search for searching a query on multiple modal and there are different conditions on different model. EX User.multi_search(search_query+" AND NOT is_deleted:1 ",[Program],{:limit=>limit,:offset=>offset}) And I have to condition "is_visible = true" on program model. How can I modify above query. Can we you INNER JOIN query in find_by_contents and in mult_search -- Regads Santosh R Patil Antiz Technologes (P) Limited Mobile No :9886896369 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20071213/6610c8a4/attachment.html From jnchrls at FlashCodersNY.org Thu Dec 13 15:28:09 2007 From: jnchrls at FlashCodersNY.org (Jean-Charles Carelli) Date: Thu, 13 Dec 2007 15:28:09 -0500 Subject: [Ferret-talk] please explain find_with_ferret, retrieve_records, :include and :conditions Message-ID: <17DEC7B8-5B66-478D-929D-28EAD17249A0@FlashCodersNY.org> Hello, I'm using find_with_ferret to search multiple models and it works great. The trouble is I need to filter the results using :include and :conditions. I get two errors depending on the syntax I use in the search. Reading the source, I see the retrieve_records method seems to filter the :include and :conditions so that they only apply to the relevant model when searching multiple models. This is exactly what I want, but I can't seem to get it to work. My question: is my syntax wrong? Or have I misread how retrieve_record works? If so, How would I apply conditions to a subset of models being searched in a multi model search? # First Try. This syntax with using a hash to contain the include params works with regular active_record calls. @results = Inventory.find_with_ferret( @query, { :multi => [ Artist], :page => params[ :page ], :per_page => 10 }, { :include => {:media_files => {}}, :conditions => [ "media_files.file and inventories.status = 'donated'" ] } ) # Resulting Error undefined method `to_sym' for [:media_files, {}]:Array # Second try. I put the :include params in [] array brackets to see if that would help the to_sym error. That fixes the to_sym error. But now the association isn't getting found? @results = Inventory.find_with_ferret( @query, { :multi => [ Artist], :page => params[ :page ], :per_page => 10 }, { :include => [:media_files => {}], :conditions => [ "media_files.file and inventories.status = 'donated'" ] } ) # Resulting Error Association named 'media_files' was not found; perhaps you misspelled it? Thanks in advance. J-C -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20071213/d582661b/attachment.html From jk at jkraemer.net Fri Dec 14 04:50:50 2007 From: jk at jkraemer.net (Jens Kraemer) Date: Fri, 14 Dec 2007 10:50:50 +0100 Subject: [Ferret-talk] please explain find_with_ferret, retrieve_records, :include and :conditions In-Reply-To: <17DEC7B8-5B66-478D-929D-28EAD17249A0@FlashCodersNY.org> References: <17DEC7B8-5B66-478D-929D-28EAD17249A0@FlashCodersNY.org> Message-ID: <20071214095050.GD26886@thunder.jkraemer.net> Hi, first of all, the include options should be a simple Array of Symbols, or, if you only want to include one relationship, a single Symbol, like :include => [ :media_files ] or :include => :media_files And yes, aaf will filter these includes for each model. Second, aaf unfortunately does not support specifying conditions on a per model basis yet, so the sql resulting from your conditions argument has to be valid for fetching records from each of the models you query - in short, only use attributes present in all of the models. Afair there's already a trac ticket regarding the implementation of per-model conditions for multi search, but I didn't find the time to implement this yet. I'll try to have a look into this over the weekend. Cheers, Jens On Thu, Dec 13, 2007 at 03:28:09PM -0500, Jean-Charles Carelli wrote: > Hello, I'm using find_with_ferret to search multiple models and it > works great. The trouble is I need to filter the results > using :include and :conditions. > > I get two errors depending on the syntax I use in the search. Reading > the source, I see the retrieve_records method seems to filter > the :include and :conditions so that they only apply to the relevant > model when searching multiple models. This is exactly what I want, but > I can't seem to get it to work. > > My question: is my syntax wrong? Or have I misread how retrieve_record > works? If so, How would I apply conditions to a subset of models being > searched in a multi model search? > > # First Try. This syntax with using a hash to contain the include > params works with regular active_record calls. > @results = Inventory.find_with_ferret( @query, > { :multi => [ Artist], :page => > params[ :page ], :per_page => 10 }, > { :include => {:media_files => > {}}, :conditions => [ "media_files.file and inventories.status = > 'donated'" ] } ) > > > > # Resulting Error > undefined method `to_sym' for [:media_files, {}]:Array > > > # Second try. I put the :include params in [] array brackets to see if > that would help the to_sym error. That fixes the to_sym error. But now > the association isn't getting found? > @results = Inventory.find_with_ferret( @query, > { :multi => > [ Artist], :page => params[ :page ], :per_page => 10 }, > { :include => > [:media_files => {}], :conditions => [ "media_files.file and > inventories.status = 'donated'" ] } ) > > # Resulting Error > Association named 'media_files' was not found; perhaps you misspelled > it? > > > Thanks in advance. > > J-C > > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk -- Jens Kr?mer http://www.jkraemer.net/ - Blog http://www.omdb.org/ - The new free film database From ij.rubylist at gmail.com Mon Dec 17 06:49:41 2007 From: ij.rubylist at gmail.com (Izidor Jerebic) Date: Mon, 17 Dec 2007 12:49:41 +0100 Subject: [Ferret-talk] are index files cross-platform? Message-ID: <38226786-FA2F-4782-9233-4A3E5F77C00C@gmail.com> Hello! I am trying to read Ferret index files from Windows machine on my Mac G5 Leopard machine, but the following returns nil: Ferret::Index::IndexReader.new( index_paths ) Should this work? Are index files guaranteed to be platform independent or not? Is there any problem if files (top direectory) are renamed? izidor P.S. I can create the index myself and then everything works. From plynchnlm at gmail.com Mon Dec 17 11:17:44 2007 From: plynchnlm at gmail.com (Paul Lynch) Date: Mon, 17 Dec 2007 11:17:44 -0500 Subject: [Ferret-talk] are index files cross-platform? In-Reply-To: <38226786-FA2F-4782-9233-4A3E5F77C00C@gmail.com> References: <38226786-FA2F-4782-9233-4A3E5F77C00C@gmail.com> Message-ID: <50d6c72a0712170817k1a4ce60dt7404e916b145b610@mail.gmail.com> I have copied Ferret index files from a Redhat Linux machine to a Windows Vista machine, and they worked. I haven't tried it on a Mac, though. On Dec 17, 2007 6:49 AM, Izidor Jerebic wrote: > Hello! > > I am trying to read Ferret index files from Windows machine on my Mac > G5 Leopard machine, but the following returns nil: > > Ferret::Index::IndexReader.new( index_paths ) > > Should this work? Are index files guaranteed to be platform > independent or not? Is there any problem if files (top direectory) > are renamed? > > > izidor > > P.S. I can create the index myself and then everything works. > > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk > -- Paul Lynch Aquilent, Inc. National Library of Medicine (Contractor) From ij.rubylist at gmail.com Mon Dec 17 11:25:44 2007 From: ij.rubylist at gmail.com (Izidor Jerebic) Date: Mon, 17 Dec 2007 17:25:44 +0100 Subject: [Ferret-talk] are index files cross-platform? In-Reply-To: <50d6c72a0712170817k1a4ce60dt7404e916b145b610@mail.gmail.com> References: <38226786-FA2F-4782-9233-4A3E5F77C00C@gmail.com> <50d6c72a0712170817k1a4ce60dt7404e916b145b610@mail.gmail.com> Message-ID: <139A6DE4-63FD-4BC3-9182-56AA2FE41A98@gmail.com> Yes, but that was copy from Intel to Intel hardware. I copied from Intel to PowerPC hardware. You know, endiannes and all that... izidor On 17.12.2007, at 17:17, Paul Lynch wrote: > I have copied Ferret index files from a Redhat Linux machine to a > Windows Vista machine, and they worked. I haven't tried it on a Mac, > though. > > On Dec 17, 2007 6:49 AM, Izidor Jerebic wrote: >> Hello! >> >> I am trying to read Ferret index files from Windows machine on my Mac >> G5 Leopard machine, but the following returns nil: >> >> Ferret::Index::IndexReader.new( index_paths ) >> >> Should this work? Are index files guaranteed to be platform >> independent or not? Is there any problem if files (top direectory) >> are renamed? >> >> >> izidor >> >> P.S. I can create the index myself and then everything works. >> >> _______________________________________________ >> Ferret-talk mailing list >> Ferret-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ferret-talk >> > > > > -- > Paul Lynch > Aquilent, Inc. > National Library of Medicine (Contractor) > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk From smaloff at veer.com Tue Dec 18 01:35:25 2007 From: smaloff at veer.com (Sheldon Maloff) Date: Tue, 18 Dec 2007 07:35:25 +0100 Subject: [Ferret-talk] please explain find_with_ferret, retrieve_records, :incl In-Reply-To: <20071214095050.GD26886@thunder.jkraemer.net> References: <17DEC7B8-5B66-478D-929D-28EAD17249A0@FlashCodersNY.org> <20071214095050.GD26886@thunder.jkraemer.net> Message-ID: <9cb4fd688600577fe99bf6da8fa9e0c8@ruby-forum.com> Jens Kr?mer wrote: > Afair there's already a trac ticket regarding the implementation of > per-model conditions for multi search, but I didn't find the time to > implement this yet. I'll try to have a look into this over the weekend. Hey Jens, did you actually manage to get to this over the weekend? I was looking over the code in your RDOC for AAF, and I saw the following in class_methods.rb, line 377: # check for per-model conditions and take these if provided if conditions = find_options[:conditions] key = model.underscore.to_sym conditions = conditions[key] if Hash === conditions end And then I noticed my copy of the code (from stable release) didn't have those lines. So I update to the bleeding edge of trunk, and it sure looks like per-model conditions are in place and working (at least with my set of models they appear to be working). So, are per-model conditions working as you would expect them to be working? Or am I completely out to lunch and imagining things? - Sheldon Maloff -- Posted via http://www.ruby-forum.com/. From ij.rubylist at gmail.com Tue Dec 18 03:57:03 2007 From: ij.rubylist at gmail.com (Izidor Jerebic) Date: Tue, 18 Dec 2007 09:57:03 +0100 Subject: [Ferret-talk] are index files cross-platform? SOLVED In-Reply-To: <139A6DE4-63FD-4BC3-9182-56AA2FE41A98@gmail.com> References: <38226786-FA2F-4782-9233-4A3E5F77C00C@gmail.com> <50d6c72a0712170817k1a4ce60dt7404e916b145b610@mail.gmail.com> <139A6DE4-63FD-4BC3-9182-56AA2FE41A98@gmail.com> Message-ID: <9E595D65-2EFD-46C4-8E21-9AC2D077EDFD@gmail.com> For the archives.... It was not a problem with contents of index files but a) some files were not copied properly and b) some slight behavioural change in ferret (?) required app to issue additional doc.load for some indexes before field values could be accessed... Everything works just fine now... izidor On 17.12.2007, at 17:25, Izidor Jerebic wrote: > > Yes, but that was copy from Intel to Intel hardware. I copied from > Intel to PowerPC hardware. You know, endiannes and all that... > > izidor > > On 17.12.2007, at 17:17, Paul Lynch wrote: > >> I have copied Ferret index files from a Redhat Linux machine to a >> Windows Vista machine, and they worked. I haven't tried it on a Mac, >> though. >> >> On Dec 17, 2007 6:49 AM, Izidor Jerebic >> wrote: >>> Hello! >>> >>> I am trying to read Ferret index files from Windows machine on my >>> Mac >>> G5 Leopard machine, but the following returns nil: >>> >>> Ferret::Index::IndexReader.new( index_paths ) >>> >>> Should this work? Are index files guaranteed to be platform >>> independent or not? Is there any problem if files (top direectory) >>> are renamed? >>> >>> >>> izidor >>> >>> P.S. I can create the index myself and then everything works. >>> >>> _______________________________________________ >>> Ferret-talk mailing list >>> Ferret-talk at rubyforge.org >>> http://rubyforge.org/mailman/listinfo/ferret-talk >>> >> >> >> >> -- >> Paul Lynch >> Aquilent, Inc. >> National Library of Medicine (Contractor) >> _______________________________________________ >> Ferret-talk mailing list >> Ferret-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ferret-talk > From kraemer at webit.de Tue Dec 18 04:46:42 2007 From: kraemer at webit.de (Jens Kraemer) Date: Tue, 18 Dec 2007 10:46:42 +0100 Subject: [Ferret-talk] please explain find_with_ferret, retrieve_records, :incl In-Reply-To: <9cb4fd688600577fe99bf6da8fa9e0c8@ruby-forum.com> References: <17DEC7B8-5B66-478D-929D-28EAD17249A0@FlashCodersNY.org> <20071214095050.GD26886@thunder.jkraemer.net> <9cb4fd688600577fe99bf6da8fa9e0c8@ruby-forum.com> Message-ID: <20071218094642.GA14697@cordoba.webit.de> Hi! Yeah, I experimented with this and it should work as intended. However I'm not sure I like it the way it is now - imho it would be cleaner to have not only conditions on a per model basis, but other AR options like include or group_by, too. That's why I didn't announce this feature yet, I just wanted to think about it a bit more ;-) One way to specify these per-model options might with in the :multi option: find_with_ferret query, :multi => { :model_a => { :conditions => ['a=?', a_Value ] }, :model_b => { :include => :some_relationship } } What do you think? Cheers, Jens On Tue, Dec 18, 2007 at 07:35:25AM +0100, Sheldon Maloff wrote: > Jens Kr?mer wrote: > > > Afair there's already a trac ticket regarding the implementation of > > per-model conditions for multi search, but I didn't find the time to > > implement this yet. I'll try to have a look into this over the weekend. > > Hey Jens, did you actually manage to get to this over the weekend? I was > looking over the code in your RDOC for AAF, and I saw the following in > class_methods.rb, line 377: > > # check for per-model conditions and take these if provided > if conditions = find_options[:conditions] > key = model.underscore.to_sym > conditions = conditions[key] if Hash === conditions > end > > And then I noticed my copy of the code (from stable release) didn't have > those lines. So I update to the bleeding edge of trunk, and it sure > looks like per-model conditions are in place and working (at least with > my set of models they appear to be working). > > So, are per-model conditions working as you would expect them to be > working? Or am I completely out to lunch and imagining things? > > - Sheldon Maloff > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk -- 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 From smaloff at veer.com Tue Dec 18 11:14:06 2007 From: smaloff at veer.com (Sheldon Maloff) Date: Tue, 18 Dec 2007 17:14:06 +0100 Subject: [Ferret-talk] please explain find_with_ferret, retrieve_records, :incl In-Reply-To: <20071218094642.GA14697@cordoba.webit.de> References: <17DEC7B8-5B66-478D-929D-28EAD17249A0@FlashCodersNY.org> <20071214095050.GD26886@thunder.jkraemer.net> <9cb4fd688600577fe99bf6da8fa9e0c8@ruby-forum.com> <20071218094642.GA14697@cordoba.webit.de> Message-ID: I thought that the current implementation looked like a quick-fix! That said, it solved an immediate problem, so I'll continue to use it until what you proposed below comes along. I like what I see below. My question would be, if I had three models, ModelA, ModelB, and ModelC and all three had conditions and includes, how would the statement look? Would it be: ModelA.find_with_ferret(query, { :page => 1, :per_page => 5, :multi => { :ModelB => { :conditions => ['b=?', b_Value ], :include => :some_B_relationship] }, :ModelC => { :conditions => ['c=?', c_Value ], :include => :some_C_relationship] }, } }, { :conditions => ['a=?', a_Value ], :include => :some_A_relationship] } ) or would it be: ModelA.find_with_ferret(query, { :page => 1, :per_page => 5, :multi => { :ModelA => { :conditions => ['a=?', a_Value ], :include => :some_A_relationship] }, :ModelB => { :conditions => ['b=?', b_Value ], :include => :some_B_relationship] }, :ModelC => { :conditions => ['c=?', c_Value ], :include => :some_C_relationship] } } } ) In the first example, the conditions for ModelA are left hanging in the find_options argument, as they would be with a single model search. The second example is much cleaner, and is (I think) what happens internally with the method call add_self_to_model_list_if_necessary(). The problem with the second example, is that the syntax between a single model search and multi-model search would be different. Looking over the AAF code, perhaps it doesn't really matter. People could use whatever syntax they're comfortable with. The last question to ponder would be, what if I didn't have any conditions or includes? Would it be ModelA.find_with_ferret(query, { :page => 1, :per_page => 5, :multi => { :ModelB => { }, :ModelC => { } } } ) I don't think I helped any, did I? What I can say, is I like bringing the conditions into the :multi, rather than having to specify the :multi as an array and then the conditions as a hash, but I can see the inconsistencies it brings to the table. Cheers, - Sheldon Maloff Jens Kraemer wrote: > find_with_ferret query, :multi => { > :model_a => { :conditions => ['a=?', a_Value ] > }, > :model_b => { :include => :some_relationship } > } > > What do you think? -- Posted via http://www.ruby-forum.com/. From anandrajaram at gmail.com Wed Dec 19 11:10:38 2007 From: anandrajaram at gmail.com (Anand Rajaram) Date: Wed, 19 Dec 2007 11:10:38 -0500 Subject: [Ferret-talk] Payload support in ferret Message-ID: Hello All: This is potentially a ferret and ruby newbie question. I RTFM-ed (the oreilly shortcut anyway) and didnt find anything obvious. Are there plans for Ferret to support the notion of "payloads" introduced in Lucene 2.2. Payloads are basically arbitrary metadata that can be stored for each term. For example, for each term I can store, say, font information for the term. ( https://issues.apache.org/jira/browse/LUCENE-755 ). Does ferret already support something like this? Are there plans in the pipeline? Thanks so much! Anand -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20071219/0bdb891e/attachment.html From john at digitalpulp.com Wed Dec 19 12:41:37 2007 From: john at digitalpulp.com (John Bachir) Date: Wed, 19 Dec 2007 12:41:37 -0500 Subject: [Ferret-talk] multi-model search best practices Message-ID: Hi folks. If I am indexing ModelA and ModelB and I want to search both of them, I usually just pick one arbitrarily and use it for #multi_search. Is there a slicker pattern, regarding from which model to invoke #multi_search? Can it be invoked directly from the Ferret library? Has anyone put together some sort of "dummy" search class? Thanks for any ideas. John From me at benjaminarai.com Thu Dec 20 03:38:22 2007 From: me at benjaminarai.com (Benjamin Arai) Date: Thu, 20 Dec 2007 00:38:22 -0800 Subject: [Ferret-talk] indexing tuples (example: "frog" => 123) as opposed to words Message-ID: <476A29FE.7040107@benjaminarai.com> Hi, I need to map words in a document back to there original word id's in my database. For example, if I had the sentence "I eat food" and I was searching for "food" I would obviously get the document back as a result. For my particular problem I need to not only get the document id but also the id of the match. Suppose my original sentence was actually represented as tuples where each word contains the word and an id number. The new structure would look something like "(I => 1, eat => 2, food => 3)". In this case I would actually like to not only get the document but also the document id number of the match, which in this case would be "3". Is there any way to do this in Ferret? FYI, my goal is to be able to go back an locate the words matches for further analysis. Any help would be greatly appreciated. Thank you. Benjamin Arai Tabbec LLC From me at benjaminarai.com Tue Dec 25 16:53:44 2007 From: me at benjaminarai.com (Benjamin Arai) Date: Tue, 25 Dec 2007 13:53:44 -0800 Subject: [Ferret-talk] Does sort work for strings work? Message-ID: <57BF129D-4636-40E9-815A-73A387475C75@benjaminarai.com> Hi, I am trying to get sorting working. I have had success with numbers but when I try to sort my string fields nothing happens. I am using the following code: options = {} s = Search::SortField.new('object_title', :reverse => false) options[:sort] = s @index.search_each("my query",options) do |id, score| puts "-->Document #{id} found with a score of #{score}" p @index[id].load end output: -->Document 0 found with a score of 0.0534844100475311 {:date=>"2004-01-01", :object_title=>"This is the first title", :title=>"1", :page=>"1", :object_content=>"This is the first content"} -->Document 1 found with a score of 0.0534844100475311 {:date=>"2005-01-01", :object_title=>"This is the second title", :title=>"2", :page=>"1", :object_content=>"This is the second content"} -->Document 2 found with a score of 0.0534844100475311 {:date=>"2006-01-01", :object_title=>"This is the third title", :title=>"3", :page=>"1", :object_content=>"This is the third content"} -->Document 3 found with a score of 0.0534844100475311 {:date=>"2007-01-01", :object_title=>"This is the fourth title", :title=>"4", :page=>"1", :object_content=>"This is the fourth content"} -->Document 4 found with a score of 0.0534844100475311 {:date=>"2008-01-01", :object_title=>"This is the fifth title", :title=>"5", :page=>"1", :object_content=>"This is the fifth content"} Notice it is not sorted by object_title! Any help would be greatly appreciated. Benjamin From bk at benjaminkrause.com Thu Dec 27 17:26:32 2007 From: bk at benjaminkrause.com (Benjamin Krause) Date: Thu, 27 Dec 2007 23:26:32 +0100 Subject: [Ferret-talk] indexing tuples (example: "frog" => 123) as opposed to words In-Reply-To: <476A29FE.7040107@benjaminarai.com> References: <476A29FE.7040107@benjaminarai.com> Message-ID: Hey .. I'm not quite sure i fully understand what you're going to achieve, but maybe TermVectors will help you. http://ferret.davebalmain.com/api/classes/Ferret/Index/TermVector.html http://ferret.davebalmain.com/trac/wiki/FAQ%3ADefinitions#Whatisaterm-vector http://ferret.davebalmain.com/trac/wiki/FAQ%3ADefinitions#Whatareterm-offsets Ben On 2007-12-20, at 09:38, Benjamin Arai wrote: > Hi, > > I need to map words in a document back to there original word id's > in my > database. For example, if I had the sentence "I eat food" and I was > searching for "food" I would obviously get the document back as a > result. For my particular problem I need to not only get the > document id > but also the id of the match. > > Suppose my original sentence was actually represented as tuples where > each word contains the word and an id number. The new structure would > look something like "(I => 1, eat => 2, food => 3)". In this case I > would actually like to not only get the document but also the document > id number of the match, which in this case would be "3". Is there any > way to do this in Ferret? > > FYI, my goal is to be able to go back an locate the words matches for > further analysis. > > Any help would be greatly appreciated. Thank you. > > Benjamin Arai > Tabbec LLC > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk Gruss Ben --- Benjamin Krause http://www.omdb.org/ bk at benjaminkrause.com From bk at benjaminkrause.com Thu Dec 27 17:17:32 2007 From: bk at benjaminkrause.com (Benjamin Krause) Date: Thu, 27 Dec 2007 23:17:32 +0100 Subject: [Ferret-talk] Does sort work for strings work? In-Reply-To: <57BF129D-4636-40E9-815A-73A387475C75@benjaminarai.com> References: <57BF129D-4636-40E9-815A-73A387475C75@benjaminarai.com> Message-ID: Hey .. see http://ferret.davebalmain.com/trac/wiki/FAQ%3ASearching#HowcanIsorttheresults Hope that helps :-) Ben On 2007-12-25, at 22:53, Benjamin Arai wrote: > Hi, > > I am trying to get sorting working. I have had success with numbers > but when I try to sort my string fields nothing happens. I am using > the following code: > > options = {} > s = Search::SortField.new('object_title', :reverse => false) > options[:sort] = s > @index.search_each("my query",options) do |id, score| > puts "-->Document #{id} found with a score of #{score}" > p @index[id].load > end > > output: > > -->Document 0 found with a score of 0.0534844100475311 > {:date=>"2004-01-01", :object_title=>"This is the first > title", :title=>"1", :page=>"1", :object_content=>"This is the first > content"} > -->Document 1 found with a score of 0.0534844100475311 > {:date=>"2005-01-01", :object_title=>"This is the second > title", :title=>"2", :page=>"1", :object_content=>"This is the second > content"} > -->Document 2 found with a score of 0.0534844100475311 > {:date=>"2006-01-01", :object_title=>"This is the third > title", :title=>"3", :page=>"1", :object_content=>"This is the third > content"} > -->Document 3 found with a score of 0.0534844100475311 > {:date=>"2007-01-01", :object_title=>"This is the fourth > title", :title=>"4", :page=>"1", :object_content=>"This is the fourth > content"} > -->Document 4 found with a score of 0.0534844100475311 > {:date=>"2008-01-01", :object_title=>"This is the fifth > title", :title=>"5", :page=>"1", :object_content=>"This is the fifth > content"} > > Notice it is not sorted by object_title! Any help would be greatly > appreciated. > > Benjamin > _______________________________________________ > Ferret-talk mailing list > Ferret-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/ferret-talk Gruss Ben --- Benjamin Krause http://www.omdb.org/ bk at benjaminkrause.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20071227/d917c4f5/attachment-0001.html From bk at benjaminkrause.com Thu Dec 27 17:34:07 2007 From: bk at benjaminkrause.com (Benjamin Krause) Date: Thu, 27 Dec 2007 23:34:07 +0100 Subject: [Ferret-talk] multi-model search best practices In-Reply-To: References: Message-ID: <6C84DA2A-EE40-4F6F-B53E-3010A4E3EE9F@benjaminkrause.com> Hey.. > If I am indexing ModelA and ModelB and I want to search both of them, > I usually just pick one arbitrarily and use it for #multi_search. > > Is there a slicker pattern, regarding from which model to invoke > #multi_search? Can it be invoked directly from the Ferret library? > Has anyone put together some sort of "dummy" search class? acts_as_ferret is storing one index per model. That is why you need the multi_search method. However, Ferret does not need to store separate indexes per model. acts_as_ferret is using a so-called MultiSearcher, see http://ferret.davebalmain.com/api/classes/Ferret/Search/MultiSearcher.html to access several indexes at once to search them all. So yes, you can use Ferrets own MultiSearcher to access all indexes you need at once. However, acts_as_ferret may change the way the index is stored in the future, so if you mix acts_as_ferret and 'standard' ferret API calls, you might have a problem with future versions of AAF. So if you don't have a specific reason to use your own MultiSearcher, you shouldn't do it :-) What do you want to achieve? Gruss Ben --- Benjamin Krause http://www.omdb.org/ bk at benjaminkrause.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20071227/b523c779/attachment.html From bk at benjaminkrause.com Thu Dec 27 17:35:40 2007 From: bk at benjaminkrause.com (Benjamin Krause) Date: Thu, 27 Dec 2007 23:35:40 +0100 Subject: [Ferret-talk] Payload support in ferret In-Reply-To: References: Message-ID: <4595A6A0-6B16-4B2A-AD7D-275F541E57FC@benjaminkrause.com> Hey .. On 2007-12-19, at 17:10, Anand Rajaram wrote: > Hello All: > This is potentially a ferret and ruby newbie question. I RTFM-ed > (the oreilly shortcut anyway) and didnt find anything obvious. > > Are there plans for Ferret to support the notion of "payloads" > introduced in Lucene 2.2. Payloads are basically arbitrary metadata > that can be stored for each term. For example, for each term I can > store, say, font information for the term. ( https://issues.apache.org/jira/browse/LUCENE-755 > ). > > Does ferret already support something like this? Are there plans in > the pipeline? don't count on any new feature for ferret in the next month .. so no, i don't think so. Cheers Ben --- Benjamin Krause http://www.omdb.org/ bk at benjaminkrause.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20071227/f25af7a1/attachment.html From john at digitalpulp.com Thu Dec 27 21:15:57 2007 From: john at digitalpulp.com (John Joseph Bachir) Date: Thu, 27 Dec 2007 21:15:57 -0500 Subject: [Ferret-talk] multi-model search best practices In-Reply-To: <6C84DA2A-EE40-4F6F-B53E-3010A4E3EE9F@benjaminkrause.com> References: <6C84DA2A-EE40-4F6F-B53E-3010A4E3EE9F@benjaminkrause.com> Message-ID: On Dec 27, 2007, at 5:34 PM, Benjamin Krause wrote: > acts_as_ferret is storing one index per model. That is why you need > the multi_search method. However, Ferret does not need to store > separate indexes per model. acts_as_ferret is using a so-called > MultiSearcher, see > > http://ferret.davebalmain.com/api/classes/Ferret/Search/MultiSearcher.html > > to access several indexes at once to search them all. So yes, you > can use Ferrets own MultiSearcher to access all indexes you need > at once. However, acts_as_ferret may change the way the index is > stored in the future, so if you mix acts_as_ferret and 'standard' > ferret > API calls, you might have a problem with future versions of AAF. > > Thanks Benjamin for your response. > So if you don't have a specific reason to use your own MultiSearcher, > you shouldn't do it :-) What do you want to achieve? If I am using ferret/AAF to index Car, Boat, and Train, and I want to perform a search on all those objects and get mixed results from all of them simultaneously, the only way I know of to achieve this is to pick one of the models -- say, Car -- and invoke Car.multi_search, with appropriate flags to specify searching all models. This works fine but is a bit sloppy since the method could have been called on any of the models. I was wondering if there is an official or unofficial way to avoid this. Cheers, John -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/ferret-talk/attachments/20071227/7f1ed1ba/attachment.html From john at digitalpulp.com Thu Dec 27 23:39:35 2007 From: john at digitalpulp.com (John Joseph Bachir) Date: Thu, 27 Dec 2007 23:39:35 -0500 Subject: [Ferret-talk] multi-model search best practices In-Reply-To: References: <6C84DA2A-EE40-4F6F-B53E-3010A4E3EE9F@benjaminkrause.com> Message-ID: <60D84B17-D57C-4444-B01F-67794D8711E0@digitalpulp.com> On Dec 27, 2007, at 9:15 PM, John Joseph Bachir wrote: >> So if you don't have a specific reason to use your own MultiSearcher, >> you shouldn't do it :-) What do you want to achieve? > > the only way I know of to achieve this is to pick one of the models > -- say, Car -- and invoke Car.multi_search, with appropriate flags > to specify searching all models. This works fine but is a bit sloppy > since the method could have been called on any of the models. I was > wondering if there is an official or unofficial way to avoid this. To be clear-- I would like to do this via the AAF API if possible, instead of directly via Ferret::Search::MultiSearcher. Jon