tballison commented on PR #3096:
URL: https://github.com/apache/tika/pull/3096#issuecomment-5513615469

   Argh. I'm sorry. I thought I posted a review yesterday. Something went wrong.
   
   I'm hesitant to add a special endpoint/parameter for thumbnails.
   
   I asked :robot: to come up with a plan to get you what you want largely with 
what exists and some of what you've added.
   
   This is what it came up with:
   
   ```
     What the PR adds vs. what exists
   
     
┌───────────────────────────────────────────────────────────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
     │                         PR piece                          │              
                                 Existing equivalent                            
                    │
     
├───────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
     │ ThumbnailDefaults (built-in → server block → request,     │ 
parse-context section in tika-config.json (baseline, loaded by the forked 
worker from the same file) + the       │
     │ per-component merge)                                      │ multipart 
config part (runtime delta, overlaid in the worker)                             
                       │
     
├───────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
     │ ?renderThumbnails=true query param                        │ sending the 
same parser blocks in the request's config part                                 
                     │
     
├───────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
     │ /unpack/thumbnail + ThumbnailSelector                     │ 
standard-unpack-selector already has includeEmbeddedResourceTypes — filter to 
THUMBNAIL/RENDERING on plain       │
     │                                                           │ /unpack      
                                                                                
                    │
     
├───────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
     │ thumbnail-defaults top-level key + TikaJsonConfig change  │ not needed   
                                                                                
                    │
     
├───────────────────────────────────────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
     │ PDFParserConfig.maxRenderedPages                          │ no 
equivalent — this is the one genuinely missing piece (without it, rendering 
only page 1 forces maxPages: 1,   │
     │                                                           │ which cuts 
the text too)                                                                   
                      │
     
└───────────────────────────────────────────────────────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
   
     So my recommendation: keep maxRenderedPages (+ its test, 
PDF2XHTML/PDFParser wiring — it's pure parser config, exactly your preferred 
vehicle), drop the endpoint, the query
     params, ThumbnailDefaults, and ThumbnailSelector, and turn the built-in 
defaults JSON into a documented recipe (server docs + the ticket). The recipe 
is the deliverable — it's
     what the contributor actually needed a central place for.
   
     Literal JSON
   
     Initialization time — tika-config.json on a server that should render 
thumbnails on every parse (the forked worker loads this same file, so it 
applies to all endpoints with no
     request cooperation):
   
     {
       "parse-context": {
         "pdf-parser": {
           "imageStrategy": "RENDER_PAGES_AT_PAGE_END",
           "maxRenderedPages": 1,
           "ocr": { "dpi": 96, "imageType": "RGB" }
         },
         "emf-parser": { "renderImage": true, 
"renderOnlyEmbeddedResourceTypes": ["THUMBNAIL"] },
         "wmf-parser": { "renderImage": true, 
"renderOnlyEmbeddedResourceTypes": ["THUMBNAIL"] }
       }
     }
   
     Parse time, scenario A — the contributor's search-indexing case (metadata 
+ text + thumbnail in one parse). POST /rmeta/config, multipart parts file + 
config, config part:
   
     {
       "parse-context": {
         "pdf-parser": {
           "imageStrategy": "RENDER_PAGES_AT_PAGE_END",
           "maxRenderedPages": 1,
           "ocr": { "dpi": 96, "imageType": "RGB" }
         },
         "emf-parser": { "renderImage": true, 
"renderOnlyEmbeddedResourceTypes": ["THUMBNAIL"] },
         "wmf-parser": { "renderImage": true, 
"renderOnlyEmbeddedResourceTypes": ["THUMBNAIL"] }
       }
     }
   
     Parse time, scenario B — "just give me the thumbnail" (replaces 
/unpack/thumbnail). POST /unpack, config part:
   
     {
       "parse-context": {
         "pdf-parser": {
           "imageStrategy": "RENDER_PAGES_AT_PAGE_END",
           "maxRenderedPages": 1,
           "ocr": { "dpi": 96, "imageType": "RGB" }
         },
         "emf-parser": { "renderImage": true, 
"renderOnlyEmbeddedResourceTypes": ["THUMBNAIL"] },
         "wmf-parser": { "renderImage": true, 
"renderOnlyEmbeddedResourceTypes": ["THUMBNAIL"] },
         "standard-unpack-selector": { "includeEmbeddedResourceTypes": 
["THUMBNAIL", "RENDERING"] },
         "unpack-config": { "suffixStrategy": "DETECTED", "outputFormat": 
"FRICTIONLESS",
                            "outputMode": "ZIPPED", "includeFullMetadata": true 
},
         "embedded-limits": { "maxDepth": 3, "maxCount": 20 }
       }
     }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to