Hi there, I have a model with indexed fields (F1, F2, F3...). I have a field-based search (+F1:..., +F2:...), and a global search (which queries all fields with the given terms). Both of them works ok, but I would like to exclude a term from the global search (though it should remain indexed to support the field-based search), is it possible? Thanks in advance. -- Posted via http://www.ruby-forum.com/.
Of course, the thread topic should be ''Excluding a FIELD on a search''. I''m sorry... Raul Murciano wrote:> > Hi there, > > I have a model with indexed fields (F1, F2, F3...). > > I have a field-based search (+F1:..., +F2:...), and a global search > (which queries all fields with the given terms). Both of them works ok, > but I would like to exclude a term from the global search (though it > should remain indexed to support the field-based search), is it > possible? > > Thanks in advance.-- Posted via http://www.ruby-forum.com/.
On 9/2/06, Raul Murciano <raul at murciano.net> wrote:> > Hi there, > > I have a model with indexed fields (F1, F2, F3...). > > I have a field-based search (+F1:..., +F2:...), and a global search > (which queries all fields with the given terms). Both of them works ok, > but I would like to exclude a term from the global search (though it > should remain indexed to support the field-based search), is it > possible?Hi Raul, You probably want to do something like this; require ''rubygems'' require ''ferret'' i = Ferret::I.new(:default_field => [:f1, :f2, :f3]) i << {:f1 => "hello"} i << {:f2 => "hello"} i << {:f3 => "hello"} i << {:f4 => "hello"} puts "global" i.search_each("hello") {|d, s| puts "#{d}"} puts "field" i.search_each("f4:hello") {|d, s| puts "#{d}"} This should print this out; global 0 1 2 field 3 This should be pretty simple to do through acts_as_ferret too. Cheers, Dave
Apparently Analagous Threads
- Translated (language-aware) routes in Rails application
- sem problem - did not converge
- [0.10.0 - acts_as_ferret] Problem while saving new items
- Find max of a row in data frame (like Excel)
- [LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params