簡體   English   中英

Solr Cloud:如何禁用文檔(pdf,office)元數據作為字段

[英]Solr Cloud: How to disable document (pdf, office) metadata as fields

我是Solr的新手,並在solr雲模式下使用Solr 7.3.1,並嘗試在solr中使用contentextraction索引pdf,solr中的Office文檔。

我創建了一個收藏
bin\\solr create -c tsindex -s 2 -rf 2

在SolrJ中,我的代碼看起來像

public static void main(String[] args) {
    System.out.println("Solr Indexer");
    final String solrUrl = "http://localhost:8983/solr/tsindex/";
    HttpSolrClient solr = new HttpSolrClient.Builder(solrUrl).build();
    String filename="C:\\iSampleDocs\\doc-file.doc";    
    ContentStreamUpdateRequest solrRequest = new ContentStreamUpdateRequest("/update/extract");
    try {
        solrRequest.addFile(new File(filename), "application/msword");
        solrRequest.setParam("litral.ts_ref", "ts-456123");
        //solrRequest.setParam("defaultField", "text");

        solrRequest.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
        NamedList<Object> result= solr.request(solrRequest);
        System.out.println(result);

    } catch (IOException  e) {
        e.printStackTrace();
    }catch ( SolrServerException e) {
        e.printStackTrace();
    }
}

我遇到多個問題

  1. 盡管我已經在Solr Admin UI text_general字段ts_reftext_general ,但此字段完全沒有設置。

  2. 我的目標是在一個字段中索引包含其元數據的完整文檔,然后在另一個系統(例如ts_ref字段)中設置多個引用文件的文件。 但是實際發生的是Solr提取文件的元數據並為每個元數據值創建單獨的文件。

我嘗試通過bin\\solr config -c tsindex -zkHost localhost:9983 -property update.autoCreateFields -value false禁用data driven schema functionality

當我取消注釋行solrRequest.setParam("defaultField", "text"); 從一開始,就沒有針對提取的所有元數據的單獨字段,但是,一旦我注釋了這一行並上傳了文件,元數據便會再次位於單獨的字段中(即使我再次取消注釋)。

  1. “ litral.ts_ref”這里有一個錯字,缺少一個e
  2. 您可以通過使用uprefix字段及其附帶的動態字段來忽略所有元數據字段。 請參閱說明該情況的文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM