2010/1/20 Tim Terlegård <tim.terleg...@gmail.com>: >>>> BinaryRequestWriter does not read from a file and post it >>> >>> Is there any other way or is this use case not supported? I tried this: >>> >>> $ curl <host>/solr/update/javabin -F stream.file=/tmp/data.bin >>> $ curl <host>/solr/update -F stream.body=' <commit />' >>> >>> Solr did read the file, because solr complained when the file wasn't >>> in the format the JavaBinUpdateRequestCodec expected. But no data is >>> added to the index for some reason. > >> how did you create the file /tmp/data.bin ? what is the format? > > I wrote this in the first email. It's in the javabin format (I think). > I did like this (groovy code): > > fieldId = new NamedList() > fieldId.add("name", "id") > fieldId.add("val", "9-0") > fieldId.add("boost", null) > fieldText = new NamedList() > fieldText.add("name", "text") > fieldText.add("val", "Some text") > fieldText.add("boost", null) > fieldNull = new NamedList() > fieldNull.add("boost", null) > doc = [fieldNull, fieldId, fieldText] > docs = [doc] > root = new NamedList() > root.add("docs", docs) > fos = new FileOutputStream("data.bin") > new JavaBinCodec().marshal(root, fos) > > /Tim > JavaBin is a format. use this method JavaBinUpdateRequestCodec# marshal(UpdateRequest updateRequest, OutputStream os)
The output of this can be posted to solr and it should work -- ----------------------------------------------------- Noble Paul | Systems Architect| AOL | http://aol.com