On Dec 12, 2008, at 11:53 PM, Jacob Singh wrote:
Hi Grant,
Thanks for the quick response. My Colleague looked into the code a
bit, and I did as well, here is what I see (my Java sucks):
http://svn.apache.org/repos/asf/lucene/solr/trunk/contrib/extraction/src/main/java/org/apache/solr/handler/extraction/SolrContentHandler.java
//handle the literals from the params
Iterator<String> paramNames = params.getParameterNamesIterator();
while (paramNames.hasNext()) {
String name = paramNames.next();
if (name.startsWith(LITERALS_PREFIX)) {
String fieldName = name.substring(LITERALS_PREFIX.length());
//no need to map names here, since they are literals from the
user
SchemaField schFld = schema.getFieldOrNull(fieldName);
if (schFld != null) {
String value = params.get(name);
boost = getBoost(fieldName);
//no need to transform here, b/c we can assume the user sent
it in correctly
document.addField(fieldName, value, boost);
} else {
handleUndeclaredField(fieldName);
}
}
}
I don't know the solr source quite well enough to know if
document.addField() can take a struct in the form of some serialized
string, but how can I pass a multi-valued field via a
file-upload/multi-part POST?
Ah, I think I see the problem, you want to be able to pass in multiple
literals for the same values.
In other words:
<form enctype="multipart/form-data" action="/solr/update/extract"
method="POST">
<input name="ext.literal.features" value="solr"/>
<input name="ext.literal.features" value="cool"/> <!-- HERE -->
<input name="ext.def.fl" value="text"/>
Choose a file to upload: <input name="file" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
Am I understanding correctly?
-Grant