2015-06-26 18 views
11

Sto analizzando documenti PDF e Word di grandi dimensioni usando Tika ma ricevo il seguente messaggio di errore.Come leggere file di grandi dimensioni con TIka?

Your document contained more than 100000 characters, and so your requested limit has been reached. To receive the full text of the document, increase your limit. (Text up to the limit is however available). 

Come aumentare il limite?

+0

Dipende interamente da come stai chiamando Apache Tika. Come stai chiamando Apache Tika? – Gagravarr

risposta

15

supponendo che si sta fondamentalmente seguendo il Tika example for extracting to plain text, allora tutto quello che dovete fare è create your BodyContentHandler with a write limit of -1 per disabilitare il limite di scrittura, come spiegato nel javadocs

il codice sarà quindi simile a (inspired by the example):

BodyContentHandler handler = new BodyContentHandler(-1); 

InputStream stream = ContentHandlerExample.class.getResourceAsStream("test.doc"); 
AutoDetectParser parser = new AutoDetectParser(); 
Metadata metadata = new Metadata(); 
try { 
    parser.parse(stream, handler, metadata); 
    return handler.toString(); 
} finally { 
    stream.close(); 
} 
Problemi correlati