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

Add documentation, tests #1

Open
3 tasks
killercup opened this issue Dec 31, 2016 · 11 comments
Open
3 tasks

Add documentation, tests #1

killercup opened this issue Dec 31, 2016 · 11 comments

Comments

@killercup
Copy link
Member

  • Add a Readme
  • Add basic integration tests
  • Make it compile with #[deny(missing_docs)]
@sbeckeriv
Copy link

https://gitter.im/diesel-rs/diesel?at=586c0fce9d4cc4fc537197d9

That gitter statement and diesel-rs/diesel#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.

@Boscop
Copy link

Boscop commented Jan 19, 2017

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?

@fairingrey
Copy link

I'd like to try working on this issue, if that's okay!

@sgrif
Copy link
Member

sgrif commented May 28, 2019

Go for it

@kaj
Copy link
Contributor

kaj commented May 11, 2020

There's a README.md in #18 .

@Jackbaude
Copy link

Jackbaude commented Mar 2, 2021

Some examples would also be greatly appreciated!

@jiangxiaoqiang
Copy link

Please add some example for this repo.

@weiznich
Copy link
Member

@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.

@FL33TW00D
Copy link

@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
Copy link

@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

@weiznich
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants