Tyler-pierce / giza_sphinxsearch

Sphinx Fulltext Search Client for Elixir Projects (Phoenix Example Included)
19 stars 5 forks source link

mariaex -- no process #1

Closed mazz closed 5 years ago

mazz commented 5 years ago

I checked-out the project, ran mix deps.get, mix deps.compile, iex -S mix

running the query below results in:

iex(3)> SphinxQL.new() |> SphinxQL.from("test1") |> SphinxQL.match("test") |> SphinxQL.send()

** (exit) exited in: :gen_server.call(:mysql_sphinx_client, {:checkout, #Reference<0.4171159363.3681550337.211863>, true, 5000}, 5000)
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
    (db_connection) lib/db_connection/connection.ex:54: DBConnection.Connection.checkout/2
    (db_connection) lib/db_connection.ex:920: DBConnection.checkout/2
    (db_connection) lib/db_connection.ex:742: DBConnection.run/3
    (db_connection) lib/db_connection.ex:1133: DBConnection.run_meter/3
    (db_connection) lib/db_connection.ex:636: DBConnection.execute/4
    (mariaex) lib/mariaex.ex:239: Mariaex.execute/4
    (giza_sphinxsearch) lib/giza/sphinx_ql.ex:234: Giza.SphinxQL.send/1

I've confirmed that sphinxsearch is running and can do a query via mysql -h0 -P9306 and mysql> CALL KEYWORDS ('test', 'test1', 1);

Not sure why it's not firing-up, if I look in application.ex:

    def init(opts) do
        workers = get_workers(opts, Keyword.get(opts, :workers, []), [])

        sql_client = {Mariaex,
          name: :mysql_sphinx_client, 
          hostname: Application.get_env(:giza_sphinxsearch, :host, "localhost"), 
          port: Application.get_env(:giza_sphinxsearch, :sql_port, 9306), 
          skip_database: true,
          sock_type: :tcp
        }

        Supervisor.init([sql_client|workers], strategy: :one_for_one)
    end
Tyler-pierce commented 5 years ago

@mazz is looks like nothing is starting Giza's application. Are you running Giza on it's own? I'm usually testing it as a library in my applications supervisor tree but you can start it manually the way you describe like so:

iex(1)>  _ = Giza.Application.start_link()
{:ok, #PID<0.234.0>}
iex(2)> alias Giza.SphinxQL
Giza.SphinxQL
iex(3)> SphinxQL.new() |> SphinxQL.from("test1") |> SphinxQL.match("test") |> SphinxQL.send()

Let me know if that works for you. If you are using Giza as a library in your own app, your own application file will look something like this:

def init(_) do
    import Supervisor.Spec

    children = [supervisor(Giza.Application, [])]

    Supervisor.init(children, strategy: :one_for_one)
 end

Let me know if that works or I can take a closer look

mazz commented 5 years ago

I knew it was 'pilot error', appreciate taking the time to show me something not obvious to a noob like me. :)

Tyler-pierce commented 5 years ago

Thanks for updating the issue. Happy to hear from anyone using Sphinx. Don't hesitate to chat about any other issue or comment on the experience