retire
retire copied to clipboard
Add support for binary attachments (PDF, DOC, etc)
Add support for binary attachments, such as PDF, DOC, etc file. See http://www.elasticsearch.org/guide/reference/mapping/attachment-type.html.
Basically, ES expects attachment in the form of base64-encoded data, so the API could/should take cue from rest-client
here.
yes, I would definitely appreciate that
+1
+100000 (This is so important for this gem)
Has this been added yet? If not when might it be? Much appreciated!
Yup! Yes please. +1
Hi all -- I'm not currently planning any focus on attachment support. There are many parts of the codebase which need to be refactored and cleaned up, many important features piled up in pull requests and my mind, and I don't immediately need it. I tend to not implement features without real use cases to check them against.
That said, there's some shitty code in the attachments
branch which I sketched when I was playing with it. Feel free to check it out and play with it some more.
Is there any solution to use attachment-type plugin (using tika) with Tire?
Is there still no planned support for this feature?
@vecernik You can work with attachment support via the "sending Hashes over HTTP" approach, which Tire (and other ES libraries) support. There is yet not a native, Ruby-like wrapping available.
@ryudice It is absolutely planned as a feature.
+1 on seeing a native Ruby wrapper for this in Tire...pretty please!
@karmi Would you provide some clues how to add attachments (via has_many) to AR model index (with Tire::Model::Callbacks)? I have tire-app.jar installed in exec path as well as elasticsearch-mapper-attachments, but can't find how to setup that.
hi guys, I use method milion times described on the internet to include binary attachement, but I got problems when a model has_many attachments, through: attachment_mapping...
How is it with this feature ? (just asking, this might help me actually :) thx)
I got Tire working with attachments plugin. May be it helps to someone for simple implementations...
The to_indexed_json method:
def to_indexed_json
{
title: title,
description: description,
author: author,
attachment: attachment
}.to_json
end
And here is the attachment method which converts the attachment to Base64
def attachment
if file.present?
path_to_file = Rails.root.to_s + '/public' + file_url.to_s
Base64.encode64(open(path_to_file) { |f| f.read })
else
Base64.encode64('missing')
end
end
@jonarrien, thank you