We have a solr / lucene documentindexing feature in our application.
In Servoy 5 the http plugin’s addFile function triggered the solr / lucene server to save the filename as ''stream_name" (see Metadata below)
In Servoy 6 the “stream_name” field is not set or filled. I’m curious why this is.
There is a workaround, namely by setting the value as a literal.
Metadata:
“stream_name” - The name of the ContentStream as uploaded to Solr. Depending on how the file is uploaded, this may or may not be set.
“stream_source_info” - Any source info about the stream. See ContentStream.
“stream_size” - The size of the stream in bytes(?)
“stream_content_type” - The content type of the stream, if available.
source: http://wiki.apache.org/solr/ExtractingRequestHandler
__
servoy 5 code:
var vPoster = plugins.http.getPoster(vServerAddress + ‘update/extract?literal.id=’ + vFileID + ‘&commit=true&uprefix=attr_&fmap.content=attr_content’);
var vDidAddFile = vPoster.addFile(vFileName, vFileName, vFilePath);
var vHttpCode = vPoster.doPost(); //httpCode 200 is ok
return vHttpCode;
servoy 6 code (with the workaround):
var vSafeFileName = escape(vFileName)
//compensate for the addFile problem in http plugin in Servoy 6: send filename as literal
var vURL = vServerAddress + ‘update/extract?literal.id=’ + vFileID + ‘&literal.filename=’ + vSafeFileName + ‘&commit=true&uprefix=attr_&fmap.content=attr_content’
var vClient = plugins.http.createNewHttpClient();
var vRequest = vClient.createPostRequest(vURL);
var vDidAddFile = vRequest.addFile(vFileName, vFileName, vFilePath)
vRequest = vRequest.executeRequest();
var vHttpCode = vRequest.getStatusCode(); //httpCode 200 is ok
return vHttpCode;