|
From: Seth R. <set...@gm...> - 2008-05-10 21:12:05
|
I'm looking at the source code for CLucene (0.9.20) and see that there
is a function that seems to be very handy when one doesn't know
exactly what type of documents one is dealing with (say if you want to
'explore' the index):
/** Returns an Enumeration of all the fields in a document. */
DocumentFieldEnumeration* fields() const;
When I attempt to access that method via the following perl code
#file system store
my $store = Lucene::Store::FSDirectory->getDirectory("/home/me/lucene", 0);
my $reader = Lucene::Index::IndexReader->open($store);
# get number of docs in index
my $num_docs = $reader->numDocs();
print "Found $num_docs in the index\n";
# get the nth document
for (my $count = 0; $count < $num_docs ; $count++) {
my $document = $reader->document($count);
my $fields = $document->fields;
print Dumper($fields);
}
I get this error:
Can't locate object method "fields" via package "Lucene::Document"
Am I doing something wrong here, or is this method just not accessible
via Lucene.pm?
Thanks,
Seth
|