lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Croci Francesco Luigi (ID SWS)" <fcr...@id.ethz.ch>
Subject Problem adding fields when indexing a pdf
Date Thu, 13 Mar 2014 12:46:30 GMT
When I index a pdf I would like to "manually" add the document's title in a filed named rmDocumentTitle.

I defined the filed in the schema.xml, but when I query Solr I see that the field was not
created...

Do I make something wrong?

Below the code snippet, schema and solrconfig.xml

Thank you for any hint
Francesco

...
ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract");
req.addContentStream(contentStream);

req.setParam("literal.id", file.getName().substring(0, file.getName().indexOf('.')));
req.setParam("literal.rmDocumentTitle", "test title");
req.setParam("uprefix", "ignored_");

req.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);

NamedList<Object> result = server.request(req);
...


schema.xml

<?xml version="1.0" encoding="UTF-8" ?>
<schema name="simple" version="1.1">
                <types>
                               <fieldtype name="string" class="solr.StrField" postingsFormat="SimpleText"
/>
                               <fieldtype name="ignored" class="solr.TextField" />
                               <fieldtype name="text" class="solr.TextField" postingsFormat="SimpleText">
                                               <analyzer>
                                                               <charFilter class="solr.PatternReplaceCharFilterFactory"
pattern="\n" replacement=""/>
                                                               <tokenizer class="solr.StandardTokenizerFactory"/>
                                                               <filter class="solr.LowerCaseFilterFactory"
/> <!--Lowercases the letters in each token. Leaves non-letter tokens alone.-->
                                                               <filter class="solr.ClassicFilterFactory"
/> <!--Removes dots from acronyms and 's from the end of tokens. Works only on typed
tokens produced by ClassicTokenizer or equivalent.-->
                                                               <filter class="solr.TrimFilterFactory"/>
<!--Trims whitespace at either end of a token. -->
                                                               <filter class="solr.StopFilterFactory"
ignoreCase="true"/> <!--Discards common words.  -->
                                                               <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
                                               </analyzer>
                               </fieldtype>
                </types>

                <fields>
                               <field name="signatureField" type="string" indexed="true"
stored="true" multiValued="false" />
                               <dynamicField name="ignored_*" type="ignored" multiValued="true"
indexed="false" stored="fasle" />
                               <field name="id" type="string" indexed="true" stored="true"
multiValued="false" />
                               <field name="rmDocumentTitle" type="string" indexed="true"
stored="true" multiValued="true"/>
                               <field name="fullText" indexed="true" type="text" multiValued="true"
/>
                </fields>

                <defaultSearchField>fullText</defaultSearchField>

                <solrQueryParser defaultOperator="OR" />
                <uniqueKey>id</uniqueKey>
</schema>


solrconfig.xml

<?xml version="1.0" encoding="UTF-8" ?>
<config>
                <luceneMatchVersion>LUCENE_45</luceneMatchVersion>
                <directoryFactory name='DirectoryFactory' class='solr.MMapDirectoryFactory'
/>

                <codecFactory name="CodecFactory" class="solr.SchemaCodecFactory" />

                <lib dir='${solr.core.instanceDir}\lib' />
                <lib dir="${solr.core.instanceDir}\dist\" regex="solr-cell-\d.*\.jar" />
                <lib dir="${solr.core.instanceDir}\contrib\extraction\lib" regex=".*\.jar"
/>

                <requestHandler name="standard" class="solr.StandardRequestHandler" default="true"
/>

                <requestHandler name="/update" class="solr.UpdateRequestHandler">
                               <lst name="defaults">
                                               <str name="update.chain">deduplication</str>
                               </lst>
                </requestHandler>

                <requestHandler name="/update/extract" class="solr.extraction.ExtractingRequestHandler">
                               <lst name="defaults">
                                               <str name="captureAttr">true</str>
                                               <str name="lowernames">true</str>
                                               <str name="overwrite">false</str>
                                               <str name="captureAttr">true</str>
                                               <str name="literalsOverride">true</str>
                                               <str name="uprefix">ignored_</str>
                                               <str name="fmap.a">link</str>
                                               <str name="fmap.content">fullText</str>
                                               <!-- the configuration here could be useful
for tests -->
                                               <str name="update.chain">deduplication</str>
                               </lst>
                </requestHandler>

                <updateRequestProcessorChain name="deduplication">
                               <processor
                                               class="org.apache.solr.update.processor.SignatureUpdateProcessorFactory">
                                               <bool name="overwriteDupes">false</bool>
                                               <str name="signatureField">signatureField</str>
                                               <bool name="enabled">true</bool>
                                               <str name="fields">content</str>
                                               <str name="minTokenLen">10</str>
                                               <str name="quantRate">.2</str>
                                               <str name="signatureClass">solr.update.processor.TextProfileSignature</str>
                               </processor>
                               <processor class="solr.LogUpdateProcessorFactory" />
                               <processor class="solr.RunUpdateProcessorFactory" />
                </updateRequestProcessorChain>

                <requestHandler name="/admin/"
                               class="org.apache.solr.handler.admin.AdminHandlers" />

                <lockType>none</lockType>

                <admin>
                               <defaultQuery>*:*</defaultQuery>
                </admin>

</config>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message