KinoSearch::Search::Query - base class for search queries


sub to_string { shift->abstract_death }

sub create_weight { shift->abstract_death }

# Derive a weight for a high-level query. sub to_weight { # in Lucene, this method is simply ``weight'' my ( $self, $searcher ) = @_; my $rewritten_self = $searcher->rewrite($self); my $weight = $rewritten_self->create_weight($searcher); my $sum = $weight->sum_of_squared_weights; my $sim = $self->get_similarity($searcher); my $norm = $sim->query_norm($sum); $weight->normalize($norm); return $weight; }

sub rewrite { return shift }

sub extract_terms { shift->abstract_death }

# These will be needed by MultiSearcher if we add queries which rewrite # themselves. sub combine { shift->todo_death } sub merge_boolean_queries { shift->todo_death }

# return the Similarity implementation used by the Query. sub get_similarity { my ( $self, $searcher, $field_name ) = @_; # This can be overriden in subclasses, allowing alternative Sims. return defined $field_name ? $searcher->get_similarity($field_name) : $searcher->get_similarity; }

sub clone { shift->todo_death }

1;

__END__

Back to Top


NAME

KinoSearch::Search::Query - base class for search queries

Back to Top


SYNOPSIS

    # abstract base class

Back to Top


DESCRIPTION

Base class for queries to be performed against an invindex. TermQuery is one example.

Back to Top


METHODS

set_boost get_boost

    $term_query_a->set_boost(2);
    $boolean_query->add_clause( query => $term_query_a, occur => 'SHOULD' );
    $boolean_query->add_clause( query => $term_query_b, occur => 'SHOULD' );

The boost of any Query is 1.0 by default. Setting boost to a number greater than one increases a Query's relative contribution to a score, and setting boost to a lower number decreases the contribution.

Back to Top


COPYRIGHT

Copyright 2005-2006 Marvin Humphrey

Back to Top


LICENSE, DISCLAIMER, BUGS, etc.

See KinoSearch version 0.15.

Back to Top

 KinoSearch::Search::Query - base class for search queries