Packages

A search deployment helper library. Aims to easy deployment and monitoring of distributed Manticore & Sphinx in a Linux environment

Current section

Files

Jump to
khafra_search lib khafra generate generate_from_command.ex
Raw

lib/khafra/generate/generate_from_command.ex

defmodule Khafra.Generate.GenerateFromCommand do
@moduledoc """
Functions that are responsible for generating data directly from command to files
"""
def wordform(word_source, word_destination) when is_binary(word_source) and is_binary(word_destination) do
{:ok, file} = File.open "sphinx/wordforms.txt", [:append]
_ = IO.binwrite file, "#{word_source} > #{word_destination}\n"
_ = File.close file
{:ok, "#{word_source} > #{word_destination}"}
end
def wordform(_, _), do: {:error, "wordform only accepts binary source and destination arguments"}
end