Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix module namespace #190

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ impl<'a> From<&'a Value> for BorrowedSerdeValue<'a> {
/// ... {"unsigned": 1000, "signed": -5, "float": 0.4},
/// ... schema,
/// ... )
#[pyclass(module = "tantivy")]
#[pyclass(module = "tantivy.tantivy")]
#[derive(Clone, Default, PartialEq)]
pub(crate) struct Document {
pub(crate) field_values: BTreeMap<String, Vec<Value>>,
Expand Down
2 changes: 1 addition & 1 deletion src/facet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use tantivy::schema;
/// implicitely imply that a document belonging to a facet also belongs to the
/// ancestor of its facet. In the example above, /electronics/tv_and_video/
/// and /electronics.
#[pyclass(frozen, module = "tantivy")]
#[pyclass(frozen, module = "tantivy.tantivy")]
#[derive(Clone, Deserialize, PartialEq, Serialize)]
pub(crate) struct Facet {
pub(crate) inner: schema::Facet,
Expand Down
4 changes: 2 additions & 2 deletions src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const RELOAD_POLICY: &str = "commit";
///
/// To create an IndexWriter first create an Index and call the writer() method
/// on the index object.
#[pyclass]
#[pyclass(module = "tantivy.tantivy")]
pub(crate) struct IndexWriter {
inner_index_writer: Option<tv::IndexWriter>,
schema: tv::schema::Schema,
Expand Down Expand Up @@ -200,7 +200,7 @@ impl IndexWriter {
///
/// If an index already exists it will be opened and reused. Raises OSError
/// if there was a problem during the opening or creation of the index.
#[pyclass]
#[pyclass(module = "tantivy.tantivy")]
pub(crate) struct Index {
pub(crate) index: tv::Index,
reader: tv::IndexReader,
Expand Down
34 changes: 17 additions & 17 deletions src/parser_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl QueryParserErrorIntoPy for tv::query::QueryParserError {
}

/// Error in the query syntax.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct SyntaxError {
message: String,
}
Expand Down Expand Up @@ -131,7 +131,7 @@ impl TryFrom<tv::query::QueryParserError> for SyntaxError {
}

/// This query is unsupported.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct UnsupportedQueryError {
message: String,
}
Expand Down Expand Up @@ -180,7 +180,7 @@ impl TryFrom<tv::query::QueryParserError> for UnsupportedQueryError {
}

/// The query references a field that is not in the schema.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub struct FieldDoesNotExistError {
field: String,
}
Expand Down Expand Up @@ -230,7 +230,7 @@ impl TryFrom<tv::query::QueryParserError> for FieldDoesNotExistError {
}

/// The query contains a term for a `u64` or `i64`-field, but the value is neither.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct ExpectedIntError {
parse_int_error: ParseIntError,
}
Expand Down Expand Up @@ -294,7 +294,7 @@ impl TryFrom<tv::query::QueryParserError> for ExpectedIntError {
}

/// The query contains a term for a bytes field, but the value is not valid base64.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct ExpectedBase64Error {
decode_error: base64::DecodeError,
}
Expand Down Expand Up @@ -393,7 +393,7 @@ impl TryFrom<tv::query::QueryParserError> for ExpectedBase64Error {
}

/// The query contains a term for a `f64`-field, but the value is not a f64.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct ExpectedFloatError {
parse_float_error: ParseFloatError,
}
Expand Down Expand Up @@ -437,7 +437,7 @@ impl TryFrom<tv::query::QueryParserError> for ExpectedFloatError {
}

/// The query contains a term for a `bool`-field, but the value is not a bool.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct ExpectedBoolError {
parse_bool_error: ParseBoolError,
}
Expand Down Expand Up @@ -481,7 +481,7 @@ impl TryFrom<tv::query::QueryParserError> for ExpectedBoolError {
}

/// It is forbidden queries that are only "excluding". (e.g. -title:pop)
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct AllButQueryForbiddenError;

#[pymethods]
Expand Down Expand Up @@ -521,7 +521,7 @@ impl TryFrom<tv::query::QueryParserError> for AllButQueryForbiddenError {
}

/// If no default field is declared, running a query without any field specified is forbbidden.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct NoDefaultFieldDeclaredError;

#[pymethods]
Expand Down Expand Up @@ -561,7 +561,7 @@ impl TryFrom<tv::query::QueryParserError> for NoDefaultFieldDeclaredError {
}

/// The field searched for is not declared as indexed in the schema.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct FieldNotIndexedError {
field: String,
}
Expand Down Expand Up @@ -609,7 +609,7 @@ impl TryFrom<tv::query::QueryParserError> for FieldNotIndexedError {
}

/// A phrase query was requested for a field that does not have any positions indexed.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct FieldDoesNotHavePositionsIndexedError {
field: String,
}
Expand Down Expand Up @@ -668,7 +668,7 @@ impl TryFrom<tv::query::QueryParserError>
}

/// A phrase-prefix query requires at least two terms
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct PhrasePrefixRequiresAtLeastTwoTermsError {
/// The phrase which triggered the issue.
phrase: String,
Expand Down Expand Up @@ -736,7 +736,7 @@ impl TryFrom<tv::query::QueryParserError>
}

/// The tokenizer for the given field is unknown.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct UnknownTokenizerError {
/// The name of the tokenizer.
tokenizer: String,
Expand Down Expand Up @@ -799,7 +799,7 @@ impl TryFrom<tv::query::QueryParserError> for UnknownTokenizerError {

/// The query contains a range query with a phrase as one of the bounds. Only terms can be used as
/// bounds.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct RangeMustNotHavePhraseError;

#[pymethods]
Expand Down Expand Up @@ -839,7 +839,7 @@ impl TryFrom<tv::query::QueryParserError> for RangeMustNotHavePhraseError {
}

/// The format for the date field is not RFC 3339 compliant.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct DateFormatError {
// Keep around the entire `QueryParserError` to avoid importing the `time` crate.
inner: tv::query::QueryParserError,
Expand Down Expand Up @@ -884,7 +884,7 @@ impl TryFrom<tv::query::QueryParserError> for DateFormatError {
}

/// The format for the facet field is invalid.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct FacetFormatError {
facet_parse_error: FacetParseError,
}
Expand Down Expand Up @@ -928,7 +928,7 @@ impl TryFrom<tv::query::QueryParserError> for FacetFormatError {
}

/// The format for the ip field is invalid.
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct IpFormatError {
addr_parse_error: AddrParseError,
}
Expand Down
2 changes: 1 addition & 1 deletion src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use pyo3::{exceptions, prelude::*, types::PyAny};
use tantivy as tv;

/// Tantivy's Query
#[pyclass(frozen)]
#[pyclass(frozen, module = "tantivy.tantivy")]
pub(crate) struct Query {
pub(crate) inner: Box<dyn tv::query::Query>,
}
Expand Down
2 changes: 1 addition & 1 deletion src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use tantivy as tv;
///
/// The schema is very strict. To build the schema the `SchemaBuilder` class is
/// provided.
#[pyclass(frozen, module = "tantivy")]
#[pyclass(frozen, module = "tantivy.tantivy")]
#[derive(Deserialize, PartialEq, Serialize)]
pub(crate) struct Schema {
pub(crate) inner: tv::schema::Schema,
Expand Down
2 changes: 1 addition & 1 deletion src/schemabuilder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use tantivy::schema::{
/// >>> body = builder.add_text_field("body")
///
/// >>> schema = builder.build()
#[pyclass]
#[pyclass(module = "tantivy.tantivy")]
#[derive(Clone)]
pub(crate) struct SchemaBuilder {
pub(crate) builder: Arc<RwLock<Option<schema::SchemaBuilder>>>,
Expand Down
8 changes: 4 additions & 4 deletions src/searcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use tantivy::collector::{Count, MultiCollector, TopDocs};
/// Tantivy's Searcher class
///
/// A Searcher is used to search the index given a prepared Query.
#[pyclass]
#[pyclass(module = "tantivy.tantivy")]
pub(crate) struct Searcher {
pub(crate) inner: tv::Searcher,
}
Expand Down Expand Up @@ -40,7 +40,7 @@ impl ToPyObject for Fruit {
}
}

#[pyclass(frozen, module = "tantivy")]
#[pyclass(frozen, module = "tantivy.tantivy")]
#[derive(Clone, Copy, Deserialize, PartialEq, Serialize)]
/// Enum representing the direction in which something should be sorted.
pub(crate) enum Order {
Expand All @@ -60,7 +60,7 @@ impl From<Order> for tv::Order {
}
}

#[pyclass(frozen, module = "tantivy")]
#[pyclass(frozen, module = "tantivy.tantivy")]
#[derive(Clone, Default, Deserialize, PartialEq, Serialize)]
/// Object holding a results successful search.
pub(crate) struct SearchResult {
Expand Down Expand Up @@ -269,7 +269,7 @@ impl Searcher {
/// It consists in an id identifying its segment, and its segment-local DocId.
/// The id used for the segment is actually an ordinal in the list of segment
/// hold by a Searcher.
#[pyclass(frozen, module = "tantivy")]
#[pyclass(frozen, module = "tantivy.tantivy")]
#[derive(Clone, Debug, Deserialize, PartialEq, Serialize)]
pub(crate) struct DocAddress {
pub(crate) segment_ord: tv::SegmentOrdinal,
Expand Down
6 changes: 3 additions & 3 deletions src/snippet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use tantivy as tv;
///
/// The schema is very strict. To build the schema the `SchemaBuilder` class is
/// provided.
#[pyclass]
#[pyclass(module = "tantivy.tantivy")]
pub(crate) struct Snippet {
pub(crate) inner: tv::Snippet,
}

#[pyclass]
#[pyclass(module = "tantivy.tantivy")]
pub(crate) struct Range {
#[pyo3(get)]
start: usize,
Expand All @@ -38,7 +38,7 @@ impl Snippet {
}
}

#[pyclass]
#[pyclass(module = "tantivy.tantivy")]
pub(crate) struct SnippetGenerator {
pub(crate) field_name: String,
pub(crate) inner: tv::SnippetGenerator,
Expand Down
Loading