mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-09-02 03:03:57 +00:00
Include image alt text in post search (#5449)
* Add Alt-Text Filter to post_view.rs Added Alt-text filter to search * Actually use the Alt-text filter I added Add the call to actually use the alt-text filter I added. * Create down.sql of migration * Create up.sql * Fixing SQL format. --------- Co-authored-by: Dessalines <tyhou13@gmx.com>
This commit is contained in:
parent
493734d1b3
commit
1a299ba628
3 changed files with 10 additions and 1 deletions
|
@ -489,10 +489,11 @@ impl<'a> PostQuery<'a> {
|
|||
let searcher = fuzzy_search(search_term);
|
||||
let name_filter = post::name.ilike(searcher.clone());
|
||||
let body_filter = post::body.ilike(searcher.clone());
|
||||
let alt_text_filter = post::alt_text.ilike(searcher.clone());
|
||||
query = if o.title_only.unwrap_or_default() {
|
||||
query.filter(name_filter)
|
||||
} else {
|
||||
query.filter(name_filter.or(body_filter))
|
||||
query.filter(name_filter.or(body_filter).or(alt_text_filter))
|
||||
}
|
||||
.filter(not(post::removed.or(post::deleted)));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
DROP INDEX idx_post_trigram;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_post_trigram ON post USING gin (name gin_trgm_ops, body gin_trgm_ops);
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
DROP INDEX idx_post_trigram;
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_post_trigram ON post USING gin (name gin_trgm_ops, body gin_trgm_ops, alt_text gin_trgm_ops);
|
||||
|
Loading…
Reference in a new issue