forgotten changes to the lib that are needed for a single port of two crates working separately
This commit is contained in:
@@ -2,15 +2,13 @@
|
|||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use tantivy::{collector::TopDocs, query::QueryParser, Index, TantivyDocument};
|
use tantivy::{collector::TopDocs, query::QueryParser, Index, TantivyDocument};
|
||||||
use tonic::{transport::Server, Request, Response, Status};
|
use tonic::{Request, Response, Status};
|
||||||
use tonic_reflection::server::Builder as ReflectionBuilder;
|
|
||||||
use common::proto::multieko2::FILE_DESCRIPTOR_SET;
|
|
||||||
|
|
||||||
use common::proto::multieko2::search::{
|
use common::proto::multieko2::search::{
|
||||||
search_response::Hit,
|
search_response::Hit, SearchRequest, SearchResponse,
|
||||||
searcher_server::{Searcher, SearcherServer},
|
|
||||||
SearchRequest, SearchResponse,
|
|
||||||
};
|
};
|
||||||
|
use common::proto::multieko2::search::searcher_server::Searcher;
|
||||||
|
pub use common::proto::multieko2::search::searcher_server::SearcherServer;
|
||||||
use tantivy::schema::Value;
|
use tantivy::schema::Value;
|
||||||
|
|
||||||
pub struct SearcherService;
|
pub struct SearcherService;
|
||||||
@@ -109,24 +107,3 @@ impl Searcher for SearcherService {
|
|||||||
Ok(Response::new(response))
|
Ok(Response::new(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn run_search_service(
|
|
||||||
addr: &str,
|
|
||||||
) -> Result<(), Box<dyn std::error::Error>> {
|
|
||||||
let addr = addr.parse()?;
|
|
||||||
let searcher_service = SearcherService;
|
|
||||||
|
|
||||||
let reflection_service = ReflectionBuilder::configure()
|
|
||||||
.register_encoded_file_descriptor_set(FILE_DESCRIPTOR_SET)
|
|
||||||
.build_v1()?;
|
|
||||||
|
|
||||||
println!("Search service listening on {}", addr);
|
|
||||||
|
|
||||||
Server::builder()
|
|
||||||
.add_service(SearcherServer::new(searcher_service))
|
|
||||||
.add_service(reflection_service)
|
|
||||||
.serve(addr)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user