diesel_full_text_search icon indicating copy to clipboard operation
diesel_full_text_search copied to clipboard

Add documentation, tests

Open killercup opened this issue 8 years ago • 11 comments

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

killercup avatar Dec 31 '16 13:12 killercup

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.

sbeckeriv avatar Jan 04 '17 04:01 sbeckeriv

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?

Boscop avatar Jan 19 '17 20:01 Boscop

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

fairingrey avatar May 28 '19 20:05 fairingrey

Go for it

sgrif avatar May 28 '19 20:05 sgrif

There's a README.md in #18 .

kaj avatar May 11 '20 10:05 kaj

Some examples would also be greatly appreciated!

Jackbaude avatar Mar 02 '21 16:03 Jackbaude

Please add some example for this repo.

jiangxiaoqiang avatar Jul 16 '22 09:07 jiangxiaoqiang

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

weiznich avatar Jul 16 '22 09:07 weiznich

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

FL33TW00D avatar Jul 16 '22 10:07 FL33TW00D

@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 avatar Jul 16 '22 14:07 jiangxiaoqiang

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

weiznich avatar Jul 16 '22 14:07 weiznich