[ 
https://issues.apache.org/jira/browse/CONNECTORS-767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13750041#comment-13750041
 ] 

Shinichiro Abe commented on CONNECTORS-767:
-------------------------------------------

Sorry. rd.setMimeType() is already called by WebConnector.

I implemented extracting file name in Solr side below.
I decoded URLs, and I considered only the last directory which has a extension 
as file.
Is it useful?

{noformat}
  doc = cmd.solrDoc;
  id = doc.getFieldValue("id");

  var paths = new Array();
  var file = "";
  var decodedId = decodeURI(id);
  paths = decodedId.split('/');
  file = paths[paths.length - 1];

  var extensionArray = 
['xml','json','csv','pdf','doc','docx','ppt','pptx','xls','xlsx','odt','odp','ods','ott','otp','ots','rtf','htm','html','txt','log'];
  
  var isInsert = new Boolean(false);
  for(i = 0; i < extensionArray.length; i++) {
    if (file.indexOf("." + extensionArray[i]) != -1) {
      isInsert = true;
      break;
    }
  }
  
  if (isInsert == true){
    doc.setField("filename_s", file);
  }
{noformat}
                
> Can we get file name in Web Connector?
> --------------------------------------
>
>                 Key: CONNECTORS-767
>                 URL: https://issues.apache.org/jira/browse/CONNECTORS-767
>             Project: ManifoldCF
>          Issue Type: Bug
>          Components: Web connector
>    Affects Versions: ManifoldCF 1.3
>            Reporter: Shinichiro Abe
>            Priority: Trivial
>
> Although file and sharedDrive connectors get file name, web connector does 
> not get file name currently. Can web connector get a file name like below? :
> RepositoryDocument rd = new RepositoryDocument();
> rd.setFileName(filename from URL);
> rd.setBinary(InputStream);

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to