Skip to content

Commit

Permalink
feat: Fine-tune GRPC-Web
Browse files Browse the repository at this point in the history
  • Loading branch information
ppodolsky committed Oct 22, 2023
1 parent 4fc6e19 commit 52288e4
Show file tree
Hide file tree
Showing 26 changed files with 11,781 additions and 12,298 deletions.
6 changes: 3 additions & 3 deletions summa-core/src/components/index_holder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tantivy::directory::OwnedBytes;
use tantivy::query::{EnableScoring, Query};
use tantivy::schema::{Field, Schema};
use tantivy::space_usage::SearcherSpaceUsage;
use tantivy::{Directory, Index, IndexBuilder, IndexReader, Opstamp, ReloadPolicy, Searcher, TantivyDocument};
use tantivy::{Directory, Index, IndexBuilder, IndexReader, Opstamp, ReloadPolicy, Searcher};
use tokio::sync::RwLock;
use tracing::{error, info, instrument, trace, warn};

Expand Down Expand Up @@ -582,7 +582,7 @@ impl IndexHolder {
&self,
searcher: &Searcher,
query_filter: &Option<proto::Query>,
documents_modifier: impl Fn(TantivyDocument) -> Option<O> + Clone + Send + Sync + 'static,
documents_modifier: impl Fn(tantivy::TantivyDocument) -> Option<O> + Clone + Send + Sync + 'static,
) -> SummaResult<tokio::sync::mpsc::Receiver<O>> {
match query_filter {
None | Some(proto::Query { query: None }) => {
Expand Down Expand Up @@ -623,7 +623,7 @@ impl IndexHolder {
&self,
searcher: &Searcher,
query: &proto::query::Query,
documents_modifier: impl Fn(TantivyDocument) -> Option<O> + Clone + Send + Sync + 'static,
documents_modifier: impl Fn(tantivy::TantivyDocument) -> Option<O> + Clone + Send + Sync + 'static,
) -> SummaResult<tokio::sync::mpsc::Receiver<O>> {
let parsed_query = self.query_parser.parse_query(query.clone())?;
let collector = tantivy::collector::DocSetCollector;
Expand Down
1 change: 0 additions & 1 deletion summa-core/src/components/summa_document.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::collections::BTreeMap;
use std::net::IpAddr;
use std::str::{from_utf8, FromStr};

Expand Down
6 changes: 1 addition & 5 deletions summa-server/src/services/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use summa_proto::proto;
use tokio_stream::wrappers::TcpListenerStream;
use tonic::codec::CompressionEncoding;
use tonic::transport::Server;
use tonic_web::GrpcWebLayer;
use tower::ServiceBuilder;
use tower_http::classify::GrpcFailureClass;
use tower_http::set_header::SetRequestHeaderLayer;
Expand Down Expand Up @@ -146,10 +145,7 @@ impl Api {
}));

if let Some(http_endpoint) = api_config.http_endpoint {
let http_router = Server::builder()
.accept_http1(true)
.layer(GrpcWebLayer::new())
.add_service(search_service);
let http_router = Server::builder().accept_http1(true).add_service(tonic_web::enable(search_service));
let http_listener = Api::set_listener(&http_endpoint)?;
let mut http_terminator = terminator.clone();
futures.push(Box::new(async move {
Expand Down
2 changes: 1 addition & 1 deletion summa-wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "summa-wasm"
version = "0.131.2"
version = "0.132.2"
authors = ["Pasha Podolsky <[email protected]>"]
edition = "2021"
license-file = "LICENSE"
Expand Down
8 changes: 6 additions & 2 deletions summa-wasm/build.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
#!/usr/bin/env bash

#./node_modules/protobufjs-cli/bin/pbjs --filter proto.filter.json --es6 --no-encode --no-decode --no-verify --no-convert --no-delimited --no-typeurl --no-service -w es6 --keep-case -t static-module -o ./src/proto.js -p ../summa-proto/proto/ ../summa-proto/proto/search_service.proto ../summa-proto/proto/index_service.proto
#./node_modules/protobufjs-cli/bin/pbts src/proto.js -o src/proto.d.ts
npx protoc \
--ts_out src/grpc-web/ \
--ts_opt long_type_string \
--ts_opt use_proto_field_name \
--proto_path ../summa-proto/proto \
../summa-proto/proto/*.proto


PATH="/usr/local/opt/llvm/bin/:$PATH" CC=/usr/local/opt/llvm/bin/clang AR=/usr/local/opt/llvm/bin/llvm-ar npm run build
Expand Down
Loading

0 comments on commit 52288e4

Please sign in to comment.