Peter Karman > LucyX-Suggester-0.004 > LucyX::Suggester



Annotate this POD



Open  0
View/Report Bugs
Module Version: 0.004   Source   Latest Release: LucyX-Suggester-0.005


LucyX::Suggester - suggest terms for Apache Lucy search


 use LucyX::Suggester;
 my $suggester = LucyX::Suggester->new(
   fields       => [qw( foo bar )],
   indexes      => $list_of_indexes,
   spellcheck   => $search_tools_spellcheck,
   limit        => 10,
   use_regex    => 0,
   max_length   => 64,
 my $suggestions = $suggester->suggest('quiK brwn fox');


Inspired by the Solr Suggester feature, LucyX::Suggester will return a list of suggested terms based on actual terms in the specified index(es). Spellchecking on query terms is performed with Search::Tools::SpellCheck, which uses Text::Aspell.


new( params )

Returns a new Suggester object. Supported params include:

fields arrayref

List of fields to limit Lexicon scans to.

indexes arrayref

List of indexes to search within.

spellcheck search_tools_spellcheck

An instance of Search::Tools::SpellCheck. Set this to indicate custom values for language, dictionary, and other params to Search::Tools::SpellCheck.

limit n

Maximum number of suggestions to return. Defaults to 10.

use_regex 1|0

Use a simple regex when comparing terms. Defaults to false (0), preferring index(). If your analyzer results in terms containing multiple words (e.g. phrases) then use_regex is probably what you want.

max_length n

Set a max term length beyond which suggestions are trimmed with substr(). Default is 64 characters. Set to 0 to disable.

suggest( query )

Returns arrayref of terms that match query.


Peter Karman, <karman at>


Please report any bugs or feature requests to bug-lucyx-suggester at, or through the web interface at I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


You can find documentation for this module with the perldoc command.

    perldoc LucyX::Suggester

You can also look for information at:


Copyright 2012 Peter Karman.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See for more information.

syntax highlighting: