search for: add_query

Displaying 14 results from an estimated 14 matches for "add_query".

2006 Jun 27
2
Using QueryParser vs building my own query
...f relying on QueryParser to do the job for me, but I''ve hit a strange problem.. Here''s how I build my query: #Main query query = Ferret::Search::BooleanQuery.new #Build query to match types typesquery = Ferret::Search::BooleanQuery.new @selected_types.each{|type| typesquery.add_query( Ferret::Search::TermQuery.new(Ferret::Index::Term.new(''type'', type)), Ferret::Search::BooleanClause::Occur::SHOULD ) } #Add types query to main query query.add_query(typesquery, Ferret::Search::BooleanClause::Occur::MUST) #Build query to match content and title conte...
2006 Jul 09
3
acts_as_ferret.. what does it actually do?
...oObject < ActiveRecord::Base acts_as_ferret :fields=> [''short_description'',''section'',''sale_category'',''sale_type'',''outcode''] def VoObject.refine_search(search_input) bq = BooleanQuery.new bq.add_query(TermQuery.new(Term.new("section", search_input), BooleanClause::Occur::Should)) filter = QueryFilter.new(bq) @vobjects = Item.find_by_contents(search_text,:filter => filter, :sort => ["section", "sale_category"]) redirect_to :results end ###########...
2006 May 31
5
Help with sorting arrays with objects in it
I have to build an array through both activerecord and also through a ferret index. I was hoping to find a way of sorting the array as i combine the two so def advanced_search(search_text, store, format, sortby) # find items in ferret index items = Item.find_by_contents(search_text) # and now find all the items from a certain store or category items_from_sql = Item.find_by_sql("SELECT *
2006 Sep 22
1
Query Objects vs. Query Strings
Hi .. I tried to build some query objects to get some documents from my index.. without success.. Is something wrong here? q = Ferret::Search::BooleanQuery.new q1 = Ferret::Search::TermQuery.new(:type, "movie") q2 = Ferret::Search::TermQuery.new(:name, "Indiana") q.add_query(q1, :should) q.add_query(q2, :should) Indexer.index.search_each(q) do |doc, score| puts doc end 0 Indexer.index.search_each(q.to_s) do |doc, score| puts doc end 70 65 68 5368 197 => 5 Ben
2007 May 14
3
How to make a Tag cloud with Ferret ?
Hello, I want to make a TAG CLOUD using ferret. How can i do so ? I would need to know the amount of keyword for every each words in the index. Thank you -- Posted via http://www.ruby-forum.com/.
2006 Aug 28
1
How should this be done with ferret 0.10.1
...ew version of ferret, has solved a few of my problems but i''m unsure of how to implement the following code in the new version of ferret? if section if !section.empty? qp = Ferret::QueryParser.new("section") query = qp.parse("\"#{section}\"") bq.add_query(query, Ferret::Search::BooleanClause::Occur::MUST) filter_on =true end end Thank you for any help offered... regards Caspar -- Posted via http://www.ruby-forum.com/.
2006 Jun 11
3
Bus Error with Ferret 0.9.3 using the BooleanQuery api
Hey guys, I''ve been trying out ferret 0.9.3 on my powerbook this weekend and I''ve been triggering ''bus errors'' when using the Query API. If I programmatically build up strings, it works just fine. There''s some more information available in the trac ticket http://ferret.davebalmain.com/trac/ticket/62 Is anyone successfully using the Query API on
2006 Jul 14
3
Whitespace Issues
I am trying to build up a filtered search using the logic below. bq = Ferret::Search::BooleanQuery.new bq.add_query(Ferret::Search::TermQuery.new(Ferret::Index::Term.new("section",section.downcase!)), Ferret::Search::BooleanClause::Occur::MUST) filter = Ferret::Search::QueryFilter.new(bq) @vobjects = VoObject.find_by_contents(search_input,:filter => filter, :sort => ["section&q...
2006 Jan 05
2
ActiveRecord callbacks not happening
Hi, I have a model class like so: class Candidate < ActiveRecord::Base validates_presence_of :name @@index = FerretConfig::INDEX def self.after_destroy puts "Ferret: after_destroy called" @@index.query_delete("+id:#{self.id} +ferret_class:#{self.class.name}") optimize_index end end But when I delete a record, the after_destroy is never called.
2006 Mar 29
1
Problems with Ferret 0.9.0
Hi, I upgraded from 0.3.2 to 0.9.0, and now my old search code doesn''t work anymore. I get a lot of ArgumentErrors, for example: "query.add_clause(Search::BooleanClause.new(query_parser.parse(term), Search::BooleanClause::Occur::MUST))" raises: ArgumentError (wrong number of arguments (2 for 0)) "index_searcher.search_each(query)" raises: ArgumentError
2006 Aug 04
1
incorrect checksum for freed object?
I''m using ferret (0.9.4) in rails, but outside of the "acts_as_ferret" plugin. Whenever I use a QueryFilter (even a very simple one), the server will crash after one, two, or three reloads of a page (same page, same query, same filter). It''s very non-deterministic and I can''t seem to reproduce it outside of my application environment (I can''t get it
2007 May 16
7
bilingual site: exclude fields set from query
Hi all, Is there a way to have searches no use some indexed fields, when processing a query? context: I have a model Foo that holds some information in two languages : - text1_nl, text2_nl, text3_nl and - text1_en, text2_en, text3_en Some other fields are common to both languages and indexed as well - first_name, last_name Depending on the visitor language choice I need to exclude the
2007 May 09
6
more_like_this
Hi, I''m using acts_as_ferret in my rails application and I''d like to use more_like_this to retrieve some ''similar'' item suggestions. I have a class ''items'' which has a status field and I need to retrieve items that only have one of the two possible statuses. Looking at the more_like_this method indicates it supports an :append_to_query
2006 Aug 25
6
End-of-File Error occured at <except.c>:103 in xpop_context
Hi, I get this when searching or adding a new record. I am using today''s version of trunk and gem ferret 0.10.0 any ideas? thanks! EOFError in DvbesController#new End-of-File Error occured at <except.c>:103 in xpop_context Error occured in store.c:197 - is_refill current pos = 0, file length = 182 RAILS_ROOT: script/../config/.. Application Trace | Framework Trace | Full