Displaying 20 results from an estimated 300 matches similar to: "Using QueryParser vs building my own query"
2006 Jul 09
3
acts_as_ferret.. what does it actually do?
Okay in this plea for help I''m going to repeat some of what i posted
before but with a larger amount of background info in the hope that i
can get a decent grip on ferret before it wriggles away..
Firstly, what does installing the acts_as_ferret plugin actually do? I
install it and add it to my model and then the index is automatically
generated and a few methods are added to it and
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
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
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 28
1
How should this be done with ferret 0.10.1
Hi i like the new 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
2019 Mar 08
0
imap segfault in libc.so with CLucene FTS backend enabled
Steps to reproduce:
- Enable CLucene FTS in Dovecot;
- Open mailbox with MUA;
- Search for message with any text;
- IMAP session crash.
OS: Gentoo Base System release 2.6
Version:
FTS: dev-cpp/clucene-2.3.3.4-r6
IMAP: net-mail/dovecot-2.3.2.1
LIBC: sys-libs/musl-1.1.21
Dovecot FTS config:
plugin {
fts = lucene
fts_lucene = whitespace_chars=@. normalize no_snowball
fts_autoindex=yes
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 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
2007 Oct 16
8
Using multiple foreign keys in views
I have a model, Game, that has_many :teams. There''s a home team and an
away team. I created two foreign keys, so each game can have two teams
associated with it. Here''s the Team model:
class Team < ActiveRecord::Base
belongs_to :game,
:class_name => ''Game'', :foreign_key => ''hometeam_id''
belongs_to :game,
:class_name =>
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
2006 Sep 04
5
uninitialized constant BooleanClause
I''ve installed the latest Win32 gem and the acts_as_ferret plugin (i
checked out the files and placed them in the vendor/plugins directory).
When I try to search I get the following error:
uninitialized constant BooleanClause
RAILS_ROOT: ./script/../config/..
Application Trace | Framework Trace | Full Trace
2006 Aug 23
4
Ferret 0.10 and Fields
Hey ...
I just tried to convert my code to 0.10 .. But i''m currently not sure
how to use fields..
i really like some of the new api.. its leaner and i like the fact that
these strange consts are gone (like
Ferret::Search::BooleanClause::Occur::MUST) ..
I see that you''re now having Ferret::Index::FieldInfo to describe the
fields of the index.. thats good.. and i now see that
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
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
2006 Dec 21
12
Ferret and Godaddy.com
Ok, first up, I''m a Rails newbie. My site is hosted on godaddy.com
Godaddy has the Ferret GEM installed by default. They do not have
acts_as_ferret installed so I can''t use that.
I''m trying to follow the tutorial on the Ferret wiki
http://ferret.davebalmain.com/trac/wiki
It includes all of the code I need, but it doesn''t tell
2005 Dec 14
2
undefined method `add'' for Ferret::Search::BooleanQuery
Up to now in my ferret development I have been using simple
single-word strings as my search queries. I just now am trying to
increase the complexity of my queries. When I was passing a single
word with no spaces in my index searches, like so:
count = index.search_each(''testing'') do |d, s|
...
end
everything worked fine. But now when I do something like this:
count =
2006 Apr 11
2
setting the default operator on a QueryParser
Hi all,
Thanks to the authors for the amazing work on Ferret! I have a question
about setting up the standard operators on a QueryParser. I would like
my parser to default to AND queries rather than the default OR.
In Java I would simply do:
QueryParser parser = new QueryParser("contents", new
StandardAnalyzer());
parser.setDefaultOperator(QueryParser.Operator.AND);
But I
2006 Apr 03
4
Stop words in queries
I''ve run in to an issue that I''m not sure how to address. Basically, I''m
building queries with occur_default Search::BooleanClause::Occur::MUST,
and using the StandardAnalyzer which does stop filtering. The stop
filtering is working beautifully on the indexing side. The problem is
that when the query parser parses through a query with a stop word in
it, say