caio.co/de/cantine

Merge branch 'tique_release'

Id
a01745e7e99bbd37d699964e18b1f16c8a7d3396
Author
Caio
Commit time
2020-01-29T14:01:16+01:00

Modified Cargo.lock

@@ -431,9 +431,9

[[package]]
name = "bytes"
-version = "0.5.3"
+version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "10004c15deb332055f7a4a208190aed362cf9a7c2f6ab70a305fba50e1105f38"
+checksum = "130aac562c0dd69c56b3b1cc8ffd2e17be31d0b6c25b61c96b76231aa23e39e1"

[[package]]
name = "bytestring"
@@ -463,6 +463,7
"base64",
"bincode",
"byteorder",
+ "cantine_derive",
"crossbeam-channel",
"env_logger",
"log",
@@ -477,6 +478,24
"tique",
"uuid",
"zerocopy",
+]
+
+[[package]]
+name = "cantine_derive"
+version = "0.1.0"
+dependencies = [
+ "cantine_derive_internal",
+ "serde",
+ "tantivy",
+]
+
+[[package]]
+name = "cantine_derive_internal"
+version = "0.1.0"
+dependencies = [
+ "proc-macro2 1.0.8",
+ "quote 1.0.2",
+ "syn 1.0.14",
]

[[package]]
@@ -1067,9 +1086,9

[[package]]
name = "itoa"
-version = "0.4.4"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f"
+checksum = "b8b7a7c0c47db5545ed3fef7468ee7bb5b74691498139e4b3f6a20685dc6dd8e"

[[package]]
name = "kernel32-sys"
@@ -1414,18 +1433,18

[[package]]
name = "pin-project"
-version = "0.4.7"
+version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "75fca1c4ff21f60ca2d37b80d72b63dab823a9d19d3cda3a81d18bc03f0ba8c5"
+checksum = "7804a463a8d9572f13453c516a5faea534a2403d7ced2f0c7e100eeff072772c"
dependencies = [
"pin-project-internal",
]

[[package]]
name = "pin-project-internal"
-version = "0.4.7"
+version = "0.4.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6544cd4e4ecace61075a6ec78074beeef98d58aa9a3d07d053d993b2946a90d6"
+checksum = "385322a45f2ecf3410c68d2a549a4a2685e8051d0f278e39743ff4e451cb9b3f"
dependencies = [
"proc-macro2 1.0.8",
"quote 1.0.2",
@@ -1837,9 +1856,9

[[package]]
name = "rustversion"
-version = "1.0.1"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a0538bd897e17257b0128d2fd95c2ed6df939374073a36166051a79e2eb7986"
+checksum = "b3bba175698996010c4f6dce5e7f173b6eb781fce25d2cfc45e27091ce0b79f6"
dependencies = [
"proc-macro2 1.0.8",
"quote 1.0.2",
@@ -2202,32 +2221,15
name = "tique"
version = "0.1.0"
dependencies = [
- "byteorder",
"nom",
- "rand 0.7.3",
- "serde",
"tantivy",
- "tique_derive",
- "zerocopy",
-]
-
-[[package]]
-name = "tique_derive"
-version = "0.1.0"
-dependencies = [
- "proc-macro2 1.0.8",
- "quote 1.0.2",
- "serde",
- "syn 1.0.14",
- "tantivy",
- "tique",
]

[[package]]
name = "tokio"
-version = "0.2.10"
+version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1fc73332507b971a5010664991a441b5ee0de92017f5a0e8b00fd684573045b"
+checksum = "8fdd17989496f49cdc57978c96f0c9fe5e4a58a8bddc6813c449a4624f6a030b"
dependencies = [
"bytes",
"fnv",

Modified Cargo.toml

@@ -1,6 +1,7
[workspace]

members = [
"cantine",
+ "cantine_derive",
"tique",
]

Modified cantine/Cargo.toml

@@ -8,6 +8,7
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
+cantine_derive = { path = "../cantine_derive" }
tique = { path = "../tique", features = ["unstable"] }
actix-rt = "1.0"
actix-service = "1.0"

Modified tique/Cargo.toml

@@ -1,21 +1,21
[package]
name = "tique"
version = "0.1.0"
+
+license = "MIT"
+description = "Utilities to drive a tantivy search index"
+keywords = ["tantivy", "pagination", "aggregation", "collector"]
+
+repository = "https://github.com/caio/cantine/tree/master/tique"
+homepage = "https://github.com/caio/cantine/"
authors = ["Caio Romão <contact@caio.co>"]
+readme = "README.markdown"
edition = "2018"

[features]
default = []
-unstable = ["tique_derive", "serde", "byteorder", "nom"]
+unstable = ["nom"]

[dependencies]
tantivy = "0.11"
-
-tique_derive = { path = "./tique_derive", optional = true }
-serde = { version = "1", features = ["derive"], optional = true }
-byteorder = { version = "1.3", optional = true }
nom = { version = "5", optional = true }
-
-[dev-dependencies]
-zerocopy = "0.2"
-rand = "0.7"

Modified cantine/src/model.rs

@@ -9,7 +9,7
use uuid::{self, Uuid};

use crate::database::DatabaseRecord;
-use tique::FilterAndAggregation;
+use cantine_derive::FilterAndAggregation;

#[derive(Deserialize, Serialize, Debug, PartialEq, Clone)]
pub struct Recipe {

Modified tique/src/lib.rs

@@ -34,12 +34,3

#[cfg(feature = "unstable")]
pub mod queryparser;
-
-#[cfg(feature = "unstable")]
-mod derive;
-
-#[cfg(feature = "unstable")]
-pub use derive::RangeStats;
-
-#[cfg(feature = "unstable")]
-pub use tique_derive::FilterAndAggregation;

Renamed tique/src/derive.rs to cantine_derive/src/lib.rs

@@ -1,6 +1,8
use serde::Serialize;
use std::ops::Range;

+pub use cantine_derive_internal::FilterAndAggregation;
+
#[derive(Serialize, Debug, Clone)]
pub struct RangeStats<T> {
pub min: T,

Renamed tique/tique_derive/src/lib.rs to cantine_derive/internal/src/lib.rs

@@ -356,7 +356,7

quote_spanned! { field.span()=>
#[serde(skip_serializing_if = "Vec::is_empty")]
- pub #name: Vec<tique::RangeStats<#ty>>
+ pub #name: Vec<cantine_derive::RangeStats<#ty>>
}
});

Renamed tique/tique_derive/tests/basic.rs to cantine_derive/tests/basic.rs

@@ -6,7 +6,7
Document, Index, SegmentReader,
};

-use tique::{FilterAndAggregation, RangeStats};
+use cantine_derive::{FilterAndAggregation, RangeStats};

#[derive(FilterAndAggregation, Default)]
pub struct Feat {

Renamed tique/tique_derive/Cargo.toml to cantine_derive/Cargo.toml

@@ -1,18 +1,13
[package]
-name = "tique_derive"
+name = "cantine_derive"
version = "0.1.0"
authors = ["Caio Romão <contact@caio.co>"]
edition = "2018"

-[lib]
-proc-macro = true
-
[dependencies]
-proc-macro2 = "1.0"
-syn = "1.0"
-quote = "1.0"
+cantine_derive_internal = { path = "./internal" }
+serde = { version = "1.0" }
+tantivy = "0.11"

[dev-dependencies]
-tique = { path = ".." }
serde = { version = "1.0", features = ["derive"] }
-tantivy = "0.11"

Created cantine_derive/internal/Cargo.toml

@@ -1,0 +1,13
+[package]
+name = "cantine_derive_internal"
+version = "0.1.0"
+authors = ["Caio Romão <contact@caio.co>"]
+edition = "2018"
+
+[lib]
+proc-macro = true
+
+[dependencies]
+proc-macro2 = "1.0"
+syn = "1.0"
+quote = "1.0"

Created tique/README.markdown

@@ -1,0 +1,33
+# tique
+
+Utilities to drive a tantivy search index
+
+## Overview
+
+### `conditional_collector`
+
+Collectors with built-in support for changing the ordering and
+cursor-based pagination (or rather: support for conditionally
+skipping documents that match the query).
+
+```rust
+use tique::conditional_collector::{Ascending, TopCollector};
+
+let min_rank_collector =
+ TopCollector::<f64, Ascending, _>::new(10, true).top_fast_field(f64_field);
+```
+
+Check the module docs for more details.
+
+### Unstable
+
+This crate also contains unpolished functionality that is made availble
+through the `unstable` feature flag:
+
+* `tique::query_parser`: A very simple query parser that only knows
+ about term and phrase queries (and their negation). Mostly an excuse
+ to play with `nom`
+
+* `tique_derive::FilterAndAggregation`: Takes a struct of (possibly
+ `Option`) primitives and generates a bunch of code to assist with
+ indexing, filtering and aggregating.