1

I'm using bonsai.io and want to point elasticsearch to my synonyms file. In development, this works fine, but I don't have access to /var/websolr/apps/elasticapp/current/config/ to place the file there and Rails.root doesn't give me the absolute path of the app on the server. How can I use my synonyms file with bonsai.io? Any way I can have it point to a relative path within my app or even point to a synonyms file hosted on a server I control?

2 Answers 2

6

There is a way that you can keep your synonyms in a txt file and use them in your model. Instead of specifying the path, you can just read the file right where you are configuring the synonyms.

Here is what mine used to look like:

synonym: {
          type: "synonym",
          format: "wordnet",
          synonyms_path: Rails.root.join("config", "analysis", (Rails.env == "test" ? "test" : "data"), "synonym.txt").to_s
        }

And, here is what it looks like now:

synonym: {
          type: "synonym",
          format: "wordnet",
          synonyms: File.readlines(Rails.root.join("config", "analysis", (Rails.env == "test" ? "test" : "data"), "synonym.txt"))
        }
2

I've found out from bonsai's support that this is indeed currently impossible, so I'm just including an array of synonyms in my model, which isn't ideal, but works.

1
  • 1
    Is this still not possible?
    – Jeremy
    Jan 30, 2018 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.