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
end

Thank you for any help offered…
regards
Caspar

On Mon, Aug 28, 2006 at 11:56:58AM +0200, Caspar wrote:

bq.add_query(query, Ferret::Search::BooleanClause::Occur::MUST)
filter_on =true
end
end

you don’t need to use a query parser in this case:

unless section.nil? || section.empty?
query = PhraseQuery.new(:section)
section.split.each { |term| query << term }
bq.add_query(query, :must)
filter_on =true
end

however, the query parser would now be created with

qp = Ferret::QueryParser.new(:default_field => :section)

Jens


webit! Gesellschaft für neue Medien mbH www.webit.de
Dipl.-Wirtschaftsingenieur Jens Krämer [email protected]
Schnorrstraße 76 Tel +49 351 46766 0
D-01069 Dresden Fax +49 351 46766 66