-
Notifications
You must be signed in to change notification settings - Fork 62
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
Full text search: a criteria for tsquery/tsvector would be gorgeous #83
Comments
I haven't used full text search with postgres, that's one of the reason we haven't support for it yet. Could you please send me an small example in pseudo-code of how would you like to use these functions and the equivalent postgres native sql? With that I could see how difficult is the task. Thanks! |
Thank you for looking into this!
disorder_name_fts is the disorder_name already prepared as full-text search-able format (tsvector) - per trigger function on update or insert. The two fields are looking like (SELECT disorder_name, disorder_name_fts....):
Possible SQLs: Like the following, I'll search for records with the words "spinal" AND (words beginning with) "musc" AND "atrophy"
If I do not mention the language, the locale of the database will be used, like
Using the already calculated tsvector from the field disorder_name_fts the SQL will become
or using the locale
So, the example of a function would be (found long ago somewhere on the internet):
Calling the function in criteria:
But we need a version for the case that I have already the tsvector in disorder_name_fts
Calling it:
And the absolute minimum:
... and the people have to build the arguments with the postgresql function names in them: Calling it:
...or
There is a more complicated method found here: https://forum.hibernate.org/viewtopic.php?p=2447426 There I would adapt the List of arguments to one more, to transport the information, if the database field needs the function to_tsvector() or not Thank you very much! |
sorry, I didn't want to close it |
... oh I can reopen it... |
Thank you very much for such a detailed explanation. When I have some time time I'll look at it and let you know how it goes. Are you interested in adding this feature in Grails 2 or Grails 3? |
I thank you very much in advance! Embarrassing to say, but I'm an old admin, I scripted a bit Groovy and this is my third attempt to find the time to learn Grails (3) - hands on a project. |
This a nice example and i used it thank you. I was trying to do as this example https://www.postgresql.org/docs/9.5/static/textsearch-controls.html when they use to_tsquery in FROM part of the SQL query. |
I couldn't follow my former project - because other tasks - so I didn't have the opportunity to deepen this matters any more. But well, it's an interesting question, concerning postgresql and may be this plugin :) A shot into the blue... never done: Or declare another POGO like the SQL-Result you are awaiting, use plain SQL and cast its result as an array of this POGO (?) Give it a try and then give a feed back, how it worked ;) |
A groovy plug in for a great database. Many thanks for it.
Would it be very difficult to implement functions for tsquery/tsvector also?
I think, after that, postgresql would become the most used database with grails :)
Thank you
The text was updated successfully, but these errors were encountered: