|
NAMESearch::InvertedIndex - A manager for inverted index maps SYNOPSIS use Search::InvertedIndex;
my $database = Search::InvertedIndex::DB::DB_File_SplitHash->new({
-map_name => '/www/search-engine/databases/test-maps/test',
-multi => 4,
-file_mode => 0644,
-lock_mode => 'EX',
-lock_timeout => 30,
-blocking_locks => 0,
-cachesize => 1000000,
-write_through => 0,
-read_write_mode => 'RDWR';
});
my $inv_map = Search::Inverted->new({ -database => $database });
##########################################################
# Example Update
##########################################################
my $index_data = "Some scalar - complex structure refs are ok";
my $update = Search::InvertedIndex::Update->new({
-group => 'keywords',
-index => 'http://www.nihongo.org/',
-data => $index_data,
-keys => {
'some' => 10,
'scalar' => 20,
'complex' => 15,
'structure' => 15,
'refs' => 15,
'are' => 15,
'ok' => 15,
},
});
my $result = $inv_map->update({ -update => $update });
##########################################################
# Example Query
# '-nodes' is an anon list of Search::InvertedIndex::Query
# objects (this allows constructing complex booleans by
# nesting).
#
# '-leafs' is an anon list of Search::InvertedIndex::Query::Leaf
# objects (used for individual search terms).
#
##########################################################
my $query_leaf1 = Search::InvertedIndex::Query::Leaf->new({
-key => 'complex',
-group => 'keywords',
-weight => 1,
});
my $query_leaf2 = Search::InvertedIndex::Query::Leaf->new({
-key => 'structure',
-group => 'keywords',
-weight => 1,
});
my $query_leaf3 = Search::InvertedIndex::Query::Leaf->new({
-key => 'gold',
-group => 'keywords',
-weight => 1,
});
my $query1 = Search::InvertedIndex::Query->new({
-logic => 'and',
-weight => 1,
-nodes => [],
-leafs => [$query_leaf1,$query_leaf2],
});
my $query2 = Search::InvertedIndex::Query->new({
-logic => 'or',
-weight => 1,
-nodes => [$query1],
-leafs => [$query_leaf3],
});
my $result = $inv_map->search({ -query => $query2 });
##########################################################
$inv_map->close;
DESCRIPTIONProvides the core of an inverted map based search engine. By mapping 'keys' to 'indexes' it provides ultra-fast look ups of all 'indexes' containing specific 'keys'. This produces highly scalable behavior where thousands, or even millions of records can be searched extremely quickly. Available database drivers are: Search::InvertedIndex::DB::DB_File_SplitHash Search::InvertedIndex::DB::Mysql Check the POD documentation for each database driver to determine initialization requirements. CHANGES 1.00 1999.06.16 - Initial release
1.01 1999.06.17 - Documentation fixes and fix to 'close' method in
Search::InvertedIndex::DB::DB_File_SplitHash
1.02 1999.06.18 - Major bugfix to locking system.
Performance tweaking. Roughly 3x improvement.
1.03 1999.06.30 - Documentation fixes.
1.04 1999.07.01 - Documentation fixes and caching system bugfixes.
(never publically released)
1.05 1999.10.20 - Altered ranking computation on search results
1.06 1999.10.20 - Removed 'use attrs' usage to improve portability
1.08 2000.01.25 - Bug fix to multi database code and documentation updates
1.09 2000.03.23 - Bug fix to 'Search::InvertedIndex::DB:DB_File_SplitHash' submodule
to manage case where 'open' is not performed before 'close' is called.
1.10 2000.07.05 - Delayed loading of serializer and added option to select
which serializer (Storable or Data::Dumper) to use at instance 'new' time.
This should allow module to be loaded by mod_perl via the 'PerlModule'
conf directive and enable use on platforms that do not support
'Storable' (such as Macintosh).
1.11 2000.11.29 - Added 'Search::InvertedIndex::DB::Mysql' (authored by
Michael Cramer <cramer@webkist.com>) database driver
to package.
1.12 2002.04.09 - Squashed bug in removal of an index from a group
when the index doesn't
1.13 2003.09.28 - Iterim release. Fixed false error return from
'first_key_in_group' for a group
1.14 2003.11.14 - Patch to the MySQL database driver to accomodate
changes in DBD::mysql.
1.15 2020.09.27 - Updates to build tooling. Addition of 'use warnings' 1.16 2020.09.27 - Fixed permissions for Build.PL and Makefile.PL.
Added strict and warnings to
1.17 2020.09.27 - Added LICENSE file to MANIFEST Public API
VERSION1.17 COPYRIGHTCopyright 1999-2020, Jerilyn Franz and FreeRun Technologies, Inc. (<URL:http://www.freeruntech.com/>). All Rights Reserved. LICENSEMIT License Copyright (c) 2020 Jerilyn Franz Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. AUTHORJerilyn Franz TODOIntegrate code and documentation patches from Kate Pugh. Seperate POD into .pod files. Concept item for evaluation: By storing a dense list of all indexed keywords, you would be able to use a regular expression or other fuzzy search matching scheme comparatively efficiently, locate possible words via a grep and then search on the possibilities. Seems to make sense to implement that as _another_ module that uses this module as a backend. 'Search::InvertedIndex::Fuzzy' perhaps. SEE ALSOSearch::InvertedIndex::Query Search::InvertedIndex::Query::Leaf Search::InvertedIndex::Result Search::InvertedIndex::Update Search::InvertedIndex::DB::DB_File_SplitHash Search::InvertedIndex::DB::Mysql
|