1Wiki::Toolkit::Search::UBsaesre(C3o)ntributed Perl DocumWeinktia:t:iToonolkit::Search::Base(3)
2
3
4

NAME

6       Wiki::Toolkit::Search::Base - Base class for Wiki::Toolkit search
7       plugins.
8

SYNOPSIS

10         my $search = Wiki::Toolkit::Search::XXX->new( @args );
11         my %wombat_nodes = $search->search_nodes("wombat");
12
13       This class details the methods that need to be overridden by search
14       plugins.
15

METHODS

17   "new"
18         my $search = Wiki::Toolkit::Search::XXX->new( @args );
19
20       Creates a new searcher. By default the arguments are just passed to
21       "_init", so you may wish to override that instead.
22
23   "search_nodes"
24         # Find all the nodes which contain the word 'expert'.
25         my %results = $search->search_nodes('expert');
26
27       Returns a (possibly empty) hash whose keys are the node names and whose
28       values are the scores in some kind of relevance-scoring system I
29       haven't entirely come up with yet. For OR searches, this could
30       initially be the number of terms that appear in the node, perhaps.
31
32       Defaults to AND searches (if $and_or is not supplied, or is anything
33       other than "OR" or "or").
34
35       Searches are case-insensitive.
36
37   "analyze"
38           @terms = $self->analyze($string)
39
40       Splits a string into a set of terms for indexing and searching.
41       Typically this is done case-insensitively, splitting at word
42       boundaries, and extracting words that contain at least 1 word
43       characters.
44
45   "fuzzy_title_match"
46         $wiki->write_node( "King's Cross St Pancras", "A station." );
47         my %matches = $search->fuzzy_title_match( "Kings Cross St. Pancras" );
48
49       Returns a (possibly empty) hash whose keys are the node names and whose
50       values are the scores in some kind of relevance-scoring system I
51       haven't entirely come up with yet.
52
53       Note that even if an exact match is found, any other similar enough
54       matches will also be returned. However, any exact match is guaranteed
55       to have the highest relevance score.
56
57       The matching is done against "canonicalised" forms of the search string
58       and the node titles in the database: stripping vowels, repeated letters
59       and non-word characters, and lowercasing.
60
61   "index_node"
62         $search->index_node( $node, $content, $metadata );
63
64       Indexes or reindexes the given node in the search engine indexes.  You
65       must supply both the node name and its content, but metadata is
66       optional.
67
68       If you do supply metadata, it will be used if and only if your chosen
69       search backend supports metadata indexing (see
70       "supports_metadata_indexing").  It should be a reference to a hash
71       where the keys are the names of the metadata fields and the values are
72       either scalars or references to arrays of scalars.  For example:
73
74         $search->index_node( "Calthorpe Arms", "Nice pub in Bloomsbury.",
75                              { category => [ "Pubs", "Bloomsbury" ],
76                                postcode => "WC1X 8JR" } );
77
78   canonicalise_title
79           $fuzzy = $self->canonicalise_title( $ node);
80
81       Returns the node title as suitable for fuzzy searching: with
82       punctuation and spaces removes, vowels removed, and double letters
83       squashed.
84
85   "delete_node"
86         $search->delete_node($node);
87
88       Removes the given node from the search indexes.  NOTE: It's up to you
89       to make sure the node is removed from the backend store.  Croaks on
90       error.
91
92   "supports_phrase_searches"
93         if ( $search->supports_phrase_searches ) {
94             return $search->search_nodes( '"fox in socks"' );
95         }
96
97       Returns true if this search backend supports phrase searching, and
98       false otherwise.
99
100   "supports_fuzzy_searches"
101         if ( $search->supports_fuzzy_searches ) {
102             return $search->fuzzy_title_match("Kings Cross St Pancreas");
103         }
104
105       Returns true if this search backend supports fuzzy title matching, and
106       false otherwise.
107
108   "supports_metadata_indexing"
109         if ( $search->supports_metadata_indexing ) {
110             print "This search backend indexes metadata as well as content.";
111         }
112
113       Returns true if this search backend supports metadata indexing, and
114       false otherwise.
115

SEE ALSO

117       Wiki::Toolkit
118
119
120
121perl v5.32.1                      2021-01-27    Wiki::Toolkit::Search::Base(3)
Impressum