diesel_full_text_search
diesel_full_text_search copied to clipboard
Add documentation, tests
- [ ] Add a Readme
- [ ] Add basic integration tests
- [ ] Make it compile with
#[deny(missing_docs)]
https://gitter.im/diesel-rs/diesel?at=586c0fce9d4cc4fc537197d9
That gitter statement and https://github.com/diesel-rs/diesel/issues/88 makes it sounds like this code doesnt work? If you can give show me a working example I can try a stab at some tests. I cant seem to get it to work right now.
I'm also interested in an example using ts_rank() and to_tsquery(). Like a basic example of implementing a ranked search in a table of posts. Like in this post but using diesel functions instead of raw SQL.
SELECT pid, p_title
FROM (SELECT post.id as pid,
post.title as p_title,
setweight(to_tsvector(post.language::regconfig, post.title), 'A') ||
setweight(to_tsvector(post.language::regconfig, post.content), 'B') ||
setweight(to_tsvector('simple', author.name), 'C') ||
setweight(to_tsvector('simple', coalesce(string_agg(tag.name, ' '))), 'B') as document
FROM post
JOIN author ON author.id = post.author_id
JOIN posts_tags ON posts_tags.post_id = posts_tags.tag_id
JOIN tag ON tag.id = posts_tags.tag_id
GROUP BY post.id, author.id) p_search
WHERE p_search.document @@ to_tsquery('english', 'Endangered & Species')
ORDER BY ts_rank(p_search.document, to_tsquery('english', 'Endangered & Species')) DESC;
Btw, is it possible to do to_tsvector(post.language::regconfig, post.title)
in diesel?
I'd like to try working on this issue, if that's okay!
Go for it
There's a README.md in #18 .
Some examples would also be greatly appreciated!
Please add some example for this repo.
@jiangxiaoqiang Contributions for a improved documentation are welcome. Otherwise this is currently not something the diesel team focuses on, as this crate mainly serves as demonstration how to implement similar functionality outside of diesel.
@jiangxiaoqiang Contributions for a improved documentation are welcome. Otherwise this is currently not something the diesel team focuses on, as this crate mainly serves as demonstration how to implement similar functionality outside of diesel.
I'll get around to writing a blog post about my usage at some point.
@jiangxiaoqiang Contributions for a improved documentation are welcome. Otherwise this is currently not something the diesel team focuses on, as this crate mainly serves as demonstration how to implement similar functionality outside of diesel.
I'll get around to writing a blog post about my usage at some point.
wait your blog, or could you give me a clue how to do the full text query from SO? https://stackoverflow.com/questions/73002858/how-to-using-rust-diesel-to-do-the-full-text-query
@jiangxiaoqiang Please stop using this and similar issues for such discussions. Thats off topic here. As this has happened repeatedly, insider this as a last warning.