Subject: | Bug in Apache::Solr while extracting document |
Date: | Fri, 2 Feb 2018 14:35:51 +0530 |
To: | bug-Apache-Solr [...] rt.cpan.org |
From: | Aswathy Santhosh <aswathy.santhosh [...] ejyothi.com> |
Hi,
I tried to index documents using to Solr using Apache::Solr module.
I could add the normal string fields and values. But I couldn't extract the
document.
The code I tried is as follows
#!/usr/bin/perl
use warnings;
use strict;
use Solr;
use Apache::Solr;
my $ua = 'LWP::UserAgent'->new;
$ua->credentials("abc.****:8983", "realm", "user", "pass");
my $url = 'http://abc.****.com:8983/solr/OppsBot';
my $solr = Apache::Solr->new(server => $url, agent => $ua);
my $doc =
'/opt/solr/example/exampledocs/Opptydocs/Redacted_purchase_description_Microsoft_Premier_Support_Sowftware_PR__11073643.pdf'
;
my $fh;
open($fh, '<:encoding(UTF-8)', $doc)
or die "Could not open file '$doc' $!";
my %options = (
file => $fh,
literals => { id => 5} ,
literal_agency => 'abc',
fmap_content => 'content',
);
my $result = $solr->extractDocument(%options);
$result or die $result->errors;
The file is passed as a file handler. I tried with the option of filename
also(filepath/filename.pdf). But that also didn't work.
Please help me out whether I'm missing anything.
My Perl version : 5.16
OS Used: GNU/Linux
Thanks and Regards,
Aswathy Santhosh