1KinoSearch1::Searcher(3U)ser Contributed Perl DocumentatiKoinnoSearch1::Searcher(3)
2
3
4

NAME

6       KinoSearch1::Searcher - execute searches
7

SYNOPSIS

9           my $analyzer = KinoSearch1::Analysis::PolyAnalyzer->new(
10               language => 'en',
11           );
12
13           my $searcher = KinoSearch1::Searcher->new(
14               invindex => $invindex,
15               analyzer => $analyzer,
16           );
17           my $hits = $searcher->search( query => 'foo bar' );
18

DESCRIPTION

20       Use the Searcher class to perform queries against an invindex.
21

METHODS

23   new
24           my $searcher = KinoSearch1::Searcher->new(
25               invindex => $invindex,
26               analyzer => $analyzer,
27           );
28
29       Constructor.  Takes two labeled parameters, both of which are required.
30
31invindex - can be either a path to an invindex, or a
32           KinoSearch1::Store::InvIndex object.
33
34analyzer - An object which subclasses
35           KinoSearch1::Analysis::Analyer, such as a PolyAnalyzer.  This must
36           be identical to the Analyzer used at index-time, or the results
37           won't match up.
38
39   search
40           my $hits = $searcher->search(
41               query  => $query,  # required
42               filter => $filter, # default: undef (no filtering)
43           );
44
45       Process a search and return a Hits object.  search() expects labeled
46       hash-style parameters.
47
48query - Can be either an object which subclasses
49           KinoSearch1::Search::Query, or a query string.  If it's a query
50           string, it will be parsed using a QueryParser and a search will be
51           performed against all indexed fields in the invindex.  For more
52           sophisticated searching, supply Query objects, such as TermQuery
53           and BooleanQuery.
54
55filter - Must be a KinoSearch1::Search::QueryFilter.  Search
56           results will be limited to only those documents which pass through
57           the filter.
58

Caching a Searcher

60       When a Searcher is created, a small portion of the invindex is loaded
61       into memory.  For large document collections, this startup time may
62       become noticeable, in which case reusing the searcher is likely to
63       speed up your search application.  Caching a Searcher is especially
64       helpful when running a high-activity app under mod_perl.
65
66       Searcher objects always represent a snapshot of an invindex as it
67       existed when the Searcher was created.  If you want the search results
68       to reflect modifications to an invindex, you must create a new Searcher
69       after the update process completes.
70
72       Copyright 2005-2010 Marvin Humphrey
73

LICENSE, DISCLAIMER, BUGS, etc.

75       See KinoSearch1 version 1.01.
76
77
78
79perl v5.32.1                      2021-01-27          KinoSearch1::Searcher(3)
Impressum