Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query lucene fulltext index #393

Open
alexmm11 opened this issue Oct 1, 2019 · 2 comments
Open

Query lucene fulltext index #393

alexmm11 opened this issue Oct 1, 2019 · 2 comments
Assignees

Comments

@alexmm11
Copy link

alexmm11 commented Oct 1, 2019

Hi, the lucene fulltext docs explains how to query a field using search_class in the form:

search_class("field:value*") = true

For instance:

SELECT FROM City WHERE SEARCH_CLASS("+name:cas*  +description:beautiful") = true

So i'm wondering if is possible do the query using ":" to include the string parameter value in the params object of the query, just like:

session.query("select from OUser where name = :name", {params: { name: "admin" }})

Instead of using something like:

`SELECT FROM City WHERE SEARCH_CLASS("+name:${val1}*  +description:${val2}") = true`

I tried like this 👇 ... but didn't work 😮 😞

session.query(
  'select from City where search_class("+name: :val1 *  +description: :val2") = true',
  {
    params: {
      val1: "name",
      val2: "beautiful"
    }
  }
);
@wolf4ood
Copy link
Member

Hi @alexmm11

i think they cannot work as today. the searchClass takes a string and it does not apply parameters.

So this one will be the query passed to lucene "+name: :val1 * +description: :val2"

Let me check if we can find a way

Thanks

@wolf4ood
Copy link
Member

Probably for now the best way is to do

`SELECT FROM City WHERE SEARCH_CLASS(:query) = true`

and use only 1 param query with +name:${val1}* +description:${val2} the lucene query content

@wolf4ood wolf4ood self-assigned this Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants