Plucene::Plugin::WeightedQueryParser - Specify weights for unqualified terms


  use Plucene::Plugin::WeightedQueryParser;
  my $parser = Plucene::WeightedQueryParser->new({
          analyzer => Plucene::Plugin::Analyzer::PorterAnalyzer->new(),
          weights  => {
            title => 5,
            subtitle => 2,
            body => 1


Quite often, you want unqualified search terms (hello) to search in either the title, the body or some other part of you document. The usual way to do this is to create another field, content, and throw everything in that, then make that the default field for unqualified terms.

That's fine, until you want to add different weighting for terms - so terms found in the title of a document come first, then those in the subtitle, then the body of the document.

This module automatically remaps unqualified search terms, such as hello to (title:hello^5 OR subtitle:hello^2 OR body:hello^1), based on the weights passed in to the constructor.


Simon Cozens,

Development of this module was made possible by the generous sponsorship of Text Matters,

This module may be distributed under the same terms as Plucene itself.