私は、Cloudera Search aka Apache Solrを使用してpdf文書を索引付けしようとしていました。最初に私はツイッターのつぶやきにインデックスを付けることができました。後で私はPDFファイルのインデックスを作成しようとしました。デフォルトのスキーマでsolrctl
を使用して対応するコレクションを作成しました。私が使用しmorphlineファイルがある... Clouderaを使用したPDF文書の索引付け
solrLocator : {
# Name of solr collection
#collection : collection1
collection : pdfs
# ZooKeeper ensemble
#zkHost : "127.0.0.1:2181/solr"
zkHost : "xxx.xxx.xxx.xxx:2181,xxx.xxx.xxx.xxx:2181/solr"
# The maximum number of documents to send to Solr per network batch (throughput knob)
# batchSize : 100
}
morphlines : [
{
id : morphlinepdfs
importCommands : ["org.kitesdk.**", "org.apache.solr.**"]
commands : [
{ detectMimeType { includeDefaultMimeTypes : true } }
{
solrCell {
solrLocator : ${solrLocator}
captureAttr : true
lowernames : true
capture : [id, title, author, content, content_type, subject, description, keywords, category, resourcename, url, last_modified, links]
parsers : [ { parser : org.apache.tika.parser.pdf.PDFParser } ]
}
}
{ generateUUID { field : id } }
{ sanitizeUnknownSolrFields { solrLocator : ${solrLocator} } }
{ loadSolr: { solrLocator : ${solrLocator} } }
]
}
]
PDFのメタデータフィールド
のようなschema.xmlファイルに存在している...(私はここzkHostのIPアドレスをマスクしてきました)<field name="title" type="text_general" indexed="true" stored="true" multiValued="true"/>
<field name="subject" type="text_general" indexed="true" stored="true"/>
<field name="description" type="text_general" indexed="true" stored="true"/>
<field name="comments" type="text_general" indexed="true" stored="true"/>
<field name="author" type="text_general" indexed="true" stored="true"/>
<field name="keywords" type="text_general" indexed="true" stored="true"/>
<field name="category" type="text_general" indexed="true" stored="true"/>
<field name="resourcename" type="text_general" indexed="true" stored="true"/>
<field name="url" type="text_general" indexed="true" stored="true"/>
<field name="content_type" type="string" indexed="true" stored="true" multiValued="true"/>
<field name="last_modified" type="date" indexed="true" stored="true"/>
<field name="links" type="string" indexed="true" stored="true" multiValued="true"/>
しかし、solr/selectクエリの出力では、コンテンツとコンテンツタイプのフィールドだけを取得しています。どのようにして、すべてのメタデータをsolrフロントエンドクエリで取得できますか? schema.xmlまたは対応するmorphlineファイルを変更する必要がありますか?また、PDFコンテンツ内のフィールドにインデックスを付けることはできますか?
私はインデックスPDFファイルに使用するコマンドは次のとおりです。事前に
hadoop --config /etc/hadoop/conf.cloudera.yarn jar /usr/lib/solr/contrib/mr/search-mr-1.0.0-cdh5.8.2-job.jar org.apache.solr.hadoop.MapReduceIndexerTool -D 'mapred.child.java.opts=-Xmx500m' --log4j /usr/share/doc/search-1.0.0+cdh5.8.2+0/examples/solr-nrt/log4j.properties --morphline-file /usr/share/doc/search-1.0.0+cdh5.8.2+0/examples/solr-nrt/test-morphlines/solrPDF.conf --output-dir hdfs://xxxxxx:8020/user/root/outdir --verbose --go-live --zk-host xxxxx:2181/solr --collection pdfs hdfs://xxxxxx:8020/user/root/indir
感謝。