xtdberl icon indicating copy to clipboard operation
xtdberl copied to clipboard

text search issues

Open samrose opened this issue 2 years ago • 3 comments

Following https://dev.solita.fi/2023/01/04/xtdb-phoenix.html

Ran the standalone jar file in "Demo" mode

querying record works, searching fails

iex(xthello@localhost)54> :xt.put(%Person{id: "demo1",
...(xthello@localhost)54>                 first_name: "Dear",
...(xthello@localhost)54>                 last_name: "Reader",
...(xthello@localhost)54>                 email: "[email protected]"})
{:ok, {0, {:timestamp, 1685713809670}}}
iex(xthello@localhost)55> :xt.ql(%Person{first_name: "Dear"})               
[
  %Person{
    id: "demo1",
    first_name: "Dear",
    last_name: "Reader",
    email: "[email protected]"
  }
]
iex(xthello@localhost)56> :xt.ql(%Person{email: {:textsearch, "example"}})
[]

I thought it's possibly due to the mode I am running xtdb in.

samrose avatar Jun 02 '23 13:06 samrose

What sort of error are you getting with text search? The demo config does include the Lucene full text search.

It is probably best to run the Clojure XTDB node separately (see xtdb/run.sh)

tatut avatar Jun 02 '23 13:06 tatut

@tatut thanks for your response, and for this incredible work

I actually wasn't getting an error, but just no results (see the empty list)

iex(xthello@localhost)56> :xt.ql(%Person{email: {:textsearch, "example"}})
[]

However, I agree that I should just run the XTDB node as you have it in this repo. I'll try that next.

samrose avatar Jun 02 '23 14:06 samrose

In the end this did work, I just didn't give xtdb lucene enough characters.

Once I added more, searching works

iex(xthello@localhost)41> :xt.ql(%Person{email: {:textsearch, "dear.reader"}})
[
  %Person{
    id: "demo1",
    first_name: "Dear",
    last_name: "Reader",
    email: "[email protected]"
  }
]
iex(xthello@localhost)42> :xt.ql(%Person{email: {:textsearch, "example"}})    
[]
iex(xthello@localhost)43> :xt.ql(%Person{email: {:textsearch, "example.com"}})
[
  %Person{
    id: "demo1",
    first_name: "Dear",
    last_name: "Reader",
    email: "[email protected]"
  },
  %Person{
    id: "demo2",
    first_name: "Bob",
    last_name: "Boogie",
    email: "[email protected]"
  }
]

samrose avatar Jun 02 '23 21:06 samrose