1KinoSearch1::Search::BoUosleeranCQounetrryi(b3u)ted PerlKiDnoocSuemaernctha1t:i:oSnearch::BooleanQuery(3)
2
3
4

NAME

6       KinoSearch1::Search::BooleanQuery - match boolean combinations of
7       Queries
8

SYNOPSIS

10           my $bool_query = KinoSearch1::Search::BooleanQuery->new;
11           $bool_query->add_clause( query => $term_query, occur => 'MUST' );
12           my $hits = $searcher->search( query => $bool_query );
13

DESCRIPTION

15       BooleanQueries are super-Query objects which match boolean combinations
16       of other Queries.
17
18       One way of producing a BooleanQuery is to feed a query string along the
19       lines of "this AND NOT that" to a QueryParser object:
20
21           my $bool_query = $query_parser->parse( 'this AND NOT that' );
22
23       It's also possible to achieve the same end by manually constructing the
24       query piece by piece:
25
26           my $bool_query = KinoSearch1::Search::BooleanQuery->new;
27
28           my $this_query = KinoSearch1::Search::TermQuery->new(
29               term => KinoSearch1::Index::Term->new( 'bodytext', 'this' ),
30           );
31           $bool_query->add_clause( query => $this_query, occur => 'MUST' );
32
33           my $that_query = KinoSearch1::Search::TermQuery->new(
34               term => KinoSearch1::Index::Term->new( 'bodytext', 'that' ),
35           );
36           $bool_query->add_clause( query => $that_query, occur => 'MUST_NOT' );
37
38       QueryParser objects and hand-rolled Queries can work together:
39
40           my $general_query = $query_parser->parse($q);
41           my $news_only     = KinoSearch1::Search::TermQuery->new(
42               term => KinoSearch1::Index::Term->new( 'category', 'news' );
43           );
44           $bool_query->add_clause( query => $general_query, occur => 'MUST' );
45           $bool_query->add_clause( query => $news_only,     occur => 'MUST' );
46

METHODS

48   new
49           my $bool_query = KinoSearch1::Search::BooleanQuery->new;
50
51       Constructor. Takes no arguments.
52
53   add_clause
54           $bool_query->add_clause(
55               query => $query, # required
56               occur => 'MUST', # default: 'SHOULD'
57           );
58
59       Add a clause to the BooleanQuery.  Takes hash-style parameters:
60
61query - an object which belongs to a subclass of
62           KinoSearch1::Search::Query.
63
64occur - must be one of three possible values: 'SHOULD', 'MUST', or
65           'MUST_NOT'.
66
68       Copyright 2005-2010 Marvin Humphrey
69

LICENSE, DISCLAIMER, BUGS, etc.

71       See KinoSearch1 version 1.01.
72
73
74
75perl v5.34.0                      2021-07-2K2inoSearch1::Search::BooleanQuery(3)
Impressum