More implementation
This commit is contained in:
parent
90ac9a1e43
commit
50a4bfcac7
@ -10,4 +10,4 @@ WHERE
|
||||
-- TODO remove AND link ~ '^<'
|
||||
ORDER BY
|
||||
ROW_NUMBER() OVER (PARTITION BY site ORDER BY date DESC)
|
||||
LIMIT 100;
|
||||
LIMIT 1000;
|
||||
|
||||
@ -670,7 +670,7 @@ impl MutationRoot {
|
||||
newsreader::refresh(pool, cacher).await?;
|
||||
|
||||
// Process email labels
|
||||
label_unprocessed(&nm, &pool, false, Some(10), "tag:unprocessed").await?;
|
||||
label_unprocessed(&nm, &pool, false, Some(1000), "tag:unprocessed").await?;
|
||||
|
||||
#[cfg(feature = "tantivy")]
|
||||
{
|
||||
|
||||
@ -754,6 +754,7 @@ pub struct Query {
|
||||
pub is_notmuch: bool,
|
||||
pub is_newsreader: bool,
|
||||
pub is_tantivy: bool,
|
||||
pub is_snoozed: bool,
|
||||
pub corpus: Option<Corpus>,
|
||||
}
|
||||
|
||||
@ -777,6 +778,9 @@ impl fmt::Display for Query {
|
||||
if self.is_newsreader {
|
||||
write!(f, "is:news ")?;
|
||||
}
|
||||
if self.is_snoozed {
|
||||
write!(f, "is:snoozed ")?;
|
||||
}
|
||||
match self.corpus {
|
||||
Some(c) => write!(f, "corpus:{c:?}")?,
|
||||
_ => (),
|
||||
@ -833,6 +837,7 @@ impl FromStr for Query {
|
||||
let mut is_notmuch = false;
|
||||
let mut is_newsreader = false;
|
||||
let mut is_tantivy = false;
|
||||
let mut is_snoozed = false;
|
||||
let mut corpus = None;
|
||||
for word in s.split_whitespace() {
|
||||
if word == "is:unread" {
|
||||
@ -872,6 +877,8 @@ impl FromStr for Query {
|
||||
is_newsreader = true;
|
||||
} else if word == "is:newsreader" {
|
||||
is_newsreader = true;
|
||||
} else if word == "is:snoozed" {
|
||||
is_snoozed = true;
|
||||
} else {
|
||||
remainder.push(word.to_string());
|
||||
}
|
||||
@ -890,6 +897,7 @@ impl FromStr for Query {
|
||||
is_notmuch,
|
||||
is_newsreader,
|
||||
is_tantivy,
|
||||
is_snoozed,
|
||||
corpus,
|
||||
})
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ use letterbox_shared::compute_color;
|
||||
use maplit::hashmap;
|
||||
use scraper::Selector;
|
||||
use sqlx::postgres::PgPool;
|
||||
use tracing::{error, info, instrument};
|
||||
use tracing::{error, info, instrument, warn};
|
||||
use url::Url;
|
||||
|
||||
use crate::{
|
||||
@ -86,6 +86,10 @@ pub async fn search(
|
||||
query: &Query,
|
||||
) -> Result<Vec<(i32, ThreadSummary)>, async_graphql::Error> {
|
||||
info!("search({after:?} {before:?} {first:?} {last:?} {query:?}");
|
||||
if query.is_snoozed {
|
||||
warn!("TODO implement snooze for newsreader::search");
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
if !is_newsreader_query(query) {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
|
||||
@ -64,6 +64,10 @@ pub async fn search(
|
||||
last: Option<i32>,
|
||||
query: &Query,
|
||||
) -> Result<Vec<(i32, ThreadSummary)>, async_graphql::Error> {
|
||||
if query.is_snoozed {
|
||||
warn!("TODO implement snooze for nm::search");
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
if !is_notmuch_query(query) {
|
||||
return Ok(Vec::new());
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user