search for: termquery

Displaying 20 results from an estimated 35 matches for "termquery".

2006 Sep 23
0
TermQuery problem
Hi, Using the 0.10.4 gem under ruby 1.8.5 (2006-08-25) [i686-linux], I get different results with a TermQuery and a search string. Namely, using a search string seems to always work whereas using a TermQuery often doesn''t return any entries. For example: > x=@i[450][:message_id] => "9e7db9110509070759732b21c4 at mail.gmail.com" > @i.search("message_id:#{x}") =...
2006 Sep 23
8
svn problems
I can consistently segfault the 0.10.4 gem, so I''m trying to get the subversion version working with hopes towards tracking the problem down. I have a fresh SVN checkout but: a) the version (in ferret.rb) claims to be 0.9.6; and b) Ferret::Index::FieldInfos and a couple other classes are missing at run time. It looks like this is because they''re not exported in the C
2006 Oct 25
1
problem with TermQuery
This might be more of a Lucene question, but I can''t figure it out. How come this works: Item.find_id_by_contents("name:Bob") but this returns no results: Item.find_id_by_contents(Ferret::Search::TermQuery.new(:name, "Bob")) Thanks in advance! -Jon -- Posted via http://www.ruby-forum.com/.
2006 Jun 27
2
Using QueryParser vs building my own query
...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 contenttitlequery = Ferret::Search::...
2006 Sep 05
4
No matches
...lysis::AsciiStandardAnalyzer.new) index << {:name => "Joe"} index << {:name => "Sandy"} index << {:name => "Billy"} index << {:name => "Lona"} index << {:name => "Frank"} index.optimize query = Search::TermQuery.new(:name, "Joe") index.search_each(query, {:limit => :all}) do |doc, score| puts ''i am here to just drink some hot chocolate.'' puts index[doc]["name"] end -------------END SCRIPT---------------- -- Posted via http://www.ruby-forum.com/.
2006 Jul 09
3
acts_as_ferret.. what does it actually do?
...t; 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 ############ I get th...
2007 Feb 01
2
Searcher do not work or I do not work
Hi. I want to learn more about ferret. So I downloaded ferret-0.10.14 and write a simple test script Only query = TermQuery.new(:content, ''program'') gives result. If I change ''program'' with ''Good'' or ''Extra'' -> no result and searching on (:title, ''Ruby'') -> no result Strange, Strange Here is the script ------- require '...
2007 Mar 21
4
Cannot delete for id of type Array
Hello list, I have a little weird error when deleting documents from the index. I''m using the following code. ferret_index = Ferret::Index::Index.new(:path => FERRET_INDEX_PATH) query = Ferret::Search::TermQuery.new(:fk_file_id, "#{_fk_file_id}") ferret_index.search_each(query) do | id | ferret_index.delete(id) end And I get the following error Cannot delete for id of type Array As I see it the only way this could happened is if search_each returns an Array of ID''s but it couldn...
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
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", "sale_category&...
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 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 Jan 02
3
Multiple indexes?
Hi, I''m indexing records from different database tables and they have identical column names in many cases. Does this mean I have to create different indexes for each table? TIA, Vamsee.
2007 Aug 23
4
scoring problem in acts_as_ferret
Hi, I am using acts_as_ferret and have a problem with scoring. I would like to organize it in such way that, if any of the searched terms fits, I get 1.0 score as a result. I will explain it on the example. I have in index: a) "one two three four" b) "one two three" c) "one two" d) "one" When I search for "one" I would like to get 1.0 score for
2007 Jan 05
3
Confused about Search Results
...here are only 10 results, and they are from two different files. Does Ferret only return 10 search results at a time or something? I''ve reindexed and stuff a few times, and the results changed slightly, but there are always 10 results. Here is my code: searcher.search_each(Search::TermQuery.new(:content, "influenza"),{}) do |id, score| puts "#{searcher[id][:title]} with score of #{score}." end What do I need to do to get the same results as I did using Lucene? I''ve read through every tutorial about Ferret I could find (that was about 4 or 5 o...
2019 Mar 08
0
imap segfault in libc.so with CLucene FTS backend enabled
...19085526e60, term=0x7945d5822dc0, searcher=0x190855007a0) at /var/tmp/portage/dev-cpp/clucene-2.3.3.4-r6/work/clucene-core-2.3.3.4/src/core/CLucene/search/Similarity.cpp:184 No locals. #11 0x000063e7edaeda51 in lucene::search::TermWeight::TermWeight(lucene::search::Searcher*, lucene::search::TermQuery*, lucene::index::Term*) () at /var/tmp/portage/dev-cpp/clucene-2.3.3.4-r6/work/clucene-core-2.3.3.4/src/core/CLucene/search/TermQuery.cpp:117 No locals. #12 0x000063e7edaeda99 in lucene::search::TermQuery::_createWeight(lucene::search::Searcher*) () at /var/tmp/portage/dev-cpp/clucene-2.3.3....
2007 Nov 04
3
Searching different fields based on document permissions
I''m currently writing a system that stores user-created documents. Each user belongs to a specific group, and the system supports multiple groups. The thing is, my users want to be able to hide pieces of a document from other groups. So for example, lets say Joe of team A has written this document: "Hello all, our secret plan is finally complete! <private>We will begin
2007 Jan 29
1
Segmentation fault in Search::Searcher#highlight
...ere''s my test code. require ''rubygems'' require ''ferret'' include Ferret::Search #searcher = Ferret::Index::Index.new(:path => ''./index'') # works searcher = Searcher.new("./index") # not works! segmentation fault!! query = TermQuery.new(:content, ARGV[0]) searcher.search_each(query) do |doc_id, score| puts "Document #{doc_id} found with a score of #{score}" puts searcher.highlight(query, doc_id, :field => :content) end Do I have some wrong implementation? Help me... -- Posted via http://www.ruby-forum.com/...
2005 Dec 14
5
Query question
I have an index in which I want different records to be accessible to different users. I think I can do this by adding a "users" field to each record in the index and narrow down my queries to only those records matching the current user''s userid. I have the userids separated by commas. What would be the right way to query for a certain user? I have to make sure that I