簡體   English   中英

獲取帶有附件文件的 Notes 文檔內容到 Solr 文檔

[英]Get the content of Notes Document with attachment file to Solr Document

我正在嘗試做的事情如下。

我有帶有字段 [from (type:text),To(type:text), Attachment(Type:RichText)] 的 Notes 文檔,然后我嘗試創建上面提到的 Notes 文檔的SolrDocument

在創建SolrDocument並將其保存到 Solr 服務器之后,我的SolrDocument如下所示。

  <doc>

  <str name="contid">340DD508D43F2F2965257ECF0045AF1C</str> // saving the UNID of the doc
   <arr name="cmrights">
       <str>DummyValue</str>
       <str>DummyValue1</str>
       <str>DummyValue2</str>
       <str>DummyValue3</str>
    </arr>
  <str name="frommail">sender@gmail.com</str>

  <date name="posteddate">2015-09-29T12:41:08Z</date> 

  <arr name="sendto">
      <str>receiver@gmial.com</str>
  </arr>

  <str name="subject">NotesSlrWriter</str>

 </doc>

為了寫在SolrInputDocument上面,我使用以下方法(它是我班級的一部分)

private void writeFields() throws Exception {
    writeField("contid", doc.getUniversalID());
    writeField("cmrights", MultiValues);
    writeField("dbtype", arvConfig);

    Collection<IDXField> fields = fieldsToIndex(arvConfig);

    for (IDXField idxField : fields) {

        int type = idxField.getDataType();
        switch (type) {

        case SQLFieldDesc.DATE:

            String DateField = idxField.getArcName();
            Collection<Date> dValues = new ArrayList<Date>();

            String d2 = doc.getItemValueDateTimeArray(DateField).get(0)
                    .toString();
            // System.out.println(d2);

            SimpleDateFormat sdf = new SimpleDateFormat(
                    "MM/dd/yyyy hh:mm:ss a");

            Date d4 = sdf.parse(d2);

            System.out.println("New Date is: " + d4.toString());
            dValues.add(d4);
            System.out.println(DateField.toLowerCase());
            System.out.println(doc.getItemValue(DateField).toString());
            writeDateField(DateField.toLowerCase(), dValues);
            break;

        case SQLFieldDesc.NUMINT:

            System.out.println("number fields");

            break;

        default:

            final String FieldName = idxField.getArcName();
            writeField(FieldName.toLowerCase(),
                    doc.getItemValueString(idxField.getArcName()));
            System.out.println(FieldName);
            System.out
                    .println(doc.getItemValueString(idxField.getArcName()));
            break;

                            }

                   }



        }

所以,我想做這樣的事情。

   solrInputDocument.writeFiles(Attachment , files which are attached);

像我必須編寫方法的東西,但我真的不明白我該如何處理或如何開始使用它,即 RichTextFormat 中的“附件”的 Notes 文檔字段。

我想我可以用我當前文檔的 dxl 來做到這一點。然后我必須通過 dxl 獲取內容,但問題是我如何在 SolrDocument 中獲取該內容。

有任何方法或步驟可以幫助我引導我走向我的解決方案。

感謝您閱讀我的問題。

您可以使用 URL 獲取 RichText 字段的 HTML 表示

http://server/db.nsf/view/docunid/RichTextFieldname?OpenField

只需通過 URL 中的 http 以 HTML 格式讀取 RichText 字段的內容。
例子:

http://server/db.nsf/0/AF665BE72463477AC1257EB90039E589/Body?OpenField

暫無
暫無

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

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