Wiki::...h::Lucy(3pm)
β¨ NAME β¨
Hey bestie! This page is Wiki::Toolkit::Search::Lucy(3pm) (filed as Wiki::...h::Lucy(3pm)) β yep, a User Contributed Perl Documentation page β and itβs all about using Lucy to search your Wiki::Toolkit wiki. π«Άπ¦
π SYNOPSIS π
my $search = Wiki::Toolkit::Search::Lucy->new( path => "/var/lucy/wiki" );
my %wombat_nodes = $search->search_nodes( "wombat" );
Provides Lucy-based search methods for Wiki::Toolkit. β¨
π METHODS π
π new π
my $search = Wiki::Toolkit::Search::Lucy->new(
path => "/var/lucy/wiki",
metadata_fields => [ "category", "locale", "address" ],
boost => { title => 2.5 },
content_munger => sub {
my $content = shift;
$content =~ s/secretword//gs;
return $content;
},
node_filter => sub {
my %args = @_;
return $args{content} =~ /REDIRECT/ ? 0 : 1;
},
);
The path parameter is mandatory. path must be a directory for storing the indexed data. It should exist and be writeable. π¨
pathβ mandatory, bestie. Itβs the directory for storing the indexed data, and it should exist and be writeable.
The other four parameters are optional:
metadata_fieldsβ should be a reference to an array of metadata field names. πboostβ should be a reference to a hash in which the keys are fields and the values are numbers β seeLucy::Plan::FieldTypefor more info. Onlytitleis currently supported as a field value. π₯content_mungerβ should be a reference to a subroutine which takes the node content as a string and returns another string which will be indexed in place of the original content. πnode_filterβ should be a reference to a subroutine which takes the named argumentsnode,content, andmetadataand returns either true (yes, index this node) or false (no, donβt index this node). π
π¨ Ordering tea: content munging takes place BEFORE node filtering.
π¦ index_node π¦
$search->index_node( $node, $content, $metadata );
Indexes or reindexes the given node in the search engine indexes. You must supply both the node name and its content, but metadata is optional. π
If you do supply metadata, it should be a reference to a hash where the keys are the names of the metadata fields and the values are either scalars or references to arrays of scalars. For example:
$search->index_node( "Calthorpe Arms", "Nice pub in Bloomsbury.",
{ category => [ "Pubs", "Bloomsbury" ],
postcode => "WC1X 8JR" } );
Only those metadata fields which were supplied to ->new will be taken notice of - others will be silently ignored. π
If content_munger has been supplied to new as a subroutine reference, then $content will be run through this before indexing. β¨
If node_filter has been supplied to new as a subroutine reference, then this will be used to check whether the node should be indexed or ignored. π¦
Content munging takes place BEFORE node filtering. π¨
πΈ search_nodes πΈ
# Find all the nodes which contain the word 'expert'.
my %results = $search->search_nodes( "expert" );
Returns a (possibly empty) hash whose keys are the node names and whose values are the scores. π
Defaults to AND searches (if $and_or is not supplied, or is anything other than "OR" or "or"). π₯
Searches are case-insensitive. π
π SEE ALSO π
Wiki::ToolkitWiki::Toolkit::Search::Base
Thatβs the whole page, bestie! Signed off from the perl v5.32.0 era, dated 2021-01-04, and filed under Wiki::...h::Lucy(3pm). πβ¨π
π¦ where this page comes from
- debian bookworm: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libwiki-toolkit-perl 0.86-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms