web & server: using tantivy for news post search
This commit is contained in:
@@ -44,6 +44,14 @@ pub struct AddTagMutation;
|
||||
)]
|
||||
pub struct RemoveTagMutation;
|
||||
|
||||
#[derive(GraphQLQuery)]
|
||||
#[graphql(
|
||||
schema_path = "graphql/schema.json",
|
||||
query_path = "graphql/refresh.graphql",
|
||||
response_derives = "Debug"
|
||||
)]
|
||||
pub struct RefreshMutation;
|
||||
|
||||
pub async fn send_graphql<Body, Resp>(body: Body) -> Result<graphql_client::Response<Resp>, Error>
|
||||
where
|
||||
Body: Serialize,
|
||||
|
||||
@@ -111,7 +111,17 @@ pub fn update(msg: Msg, model: &mut Model, orders: &mut impl Orders<Msg>) {
|
||||
Msg::Noop => {}
|
||||
Msg::RefreshStart => {
|
||||
model.refreshing_state = RefreshingState::Loading;
|
||||
orders.perform_cmd(async move { Msg::RefreshDone(api::refresh_request().await.err()) });
|
||||
orders.perform_cmd(async move {
|
||||
Msg::RefreshDone(
|
||||
send_graphql::<_, graphql::refresh_mutation::ResponseData>(
|
||||
graphql::RefreshMutation::build_query(
|
||||
graphql::refresh_mutation::Variables {},
|
||||
),
|
||||
)
|
||||
.await
|
||||
.err(),
|
||||
)
|
||||
});
|
||||
}
|
||||
Msg::RefreshDone(err) => {
|
||||
model.refreshing_state = if let Some(err) = err {
|
||||
|
||||
@@ -203,7 +203,7 @@ fn view_search_results(
|
||||
}),
|
||||
]],
|
||||
td![
|
||||
C!["from"],
|
||||
C!["from", format!("corpus-{:?} ", r.corpus)],
|
||||
a![
|
||||
C!["has-text-light", "text"],
|
||||
attrs! {
|
||||
|
||||
Reference in New Issue
Block a user