Hello! thanks for Etso!
I was wondering if it would make sense to implement https://hexdocs.pm/ecto/Ecto.Query.API.html#like/2 in Etso to have basic search capabilities.
A "trick" for prefix search could be something like
iex(55)> :ets.new(:test, [:named_table])
:test
iex(56)> :ets.insert(:test, {'key1', 'like'})
true
iex(57)> :ets.insert(:test, {'key2', 'like2'})
true
iex(58)> :ets.insert(:test, {'key3', 'will like'})
true
iex(59)> :ets.select(:test, [{{'key1' ++ :_, :_}, [], [:"$_"]}])
[{'key1', 'like'}]
iex(60)> :ets.select(:test, [{{'key2' ++ :_, :_}, [], [:"$_"]}])
[{'key2', 'like2'}]
iex(61)> :ets.select(:test, [{{'key' ++ :_, :_}, [], [:"$_"]}])
[{'key2', 'like2'}, {'key1', 'like'}, {'key3', 'will like'}]
iex(62)> :ets.select(:test, [{{:_, 'will' ++ :_}, [], [:"$_"]}])
[{'key3', 'will like'}]
iex(63)> :ets.select(:test, [{{:_, 'like' ++ :_}, [], [:"$_"]}])
[{'key2', 'like2'}, {'key1', 'like'}]
that would satisfy "a_string%", however for "%like" might be trickier
Hello! thanks for Etso!
I was wondering if it would make sense to implement https://hexdocs.pm/ecto/Ecto.Query.API.html#like/2 in Etso to have basic search capabilities.
A "trick" for prefix search could be something like
that would satisfy
"a_string%", however for"%like"might be trickier