Skip to content

Commit

Permalink
add missing inlines (#2245)
Browse files Browse the repository at this point in the history
  • Loading branch information
PSeitz authored Nov 10, 2023
1 parent 5a2397d commit 4837c78
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/schema/bytes_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,25 @@ impl From<BytesOptionsDeser> for BytesOptions {

impl BytesOptions {
/// Returns true if the value is indexed.
#[inline]
pub fn is_indexed(&self) -> bool {
self.indexed
}

/// Returns true if and only if the value is normed.
#[inline]
pub fn fieldnorms(&self) -> bool {
self.fieldnorms
}

/// Returns true if the value is a fast field.
#[inline]
pub fn is_fast(&self) -> bool {
self.fast
}

/// Returns true if the value is stored.
#[inline]
pub fn is_stored(&self) -> bool {
self.stored
}
Expand Down
4 changes: 4 additions & 0 deletions src/schema/date_time_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,25 @@ pub struct DateOptions {

impl DateOptions {
/// Returns true iff the value is stored.
#[inline]
pub fn is_stored(&self) -> bool {
self.stored
}

/// Returns true iff the value is indexed and therefore searchable.
#[inline]
pub fn is_indexed(&self) -> bool {
self.indexed
}

/// Returns true iff the field has fieldnorm.
#[inline]
pub fn fieldnorms(&self) -> bool {
self.fieldnorms && self.indexed
}

/// Returns true iff the value is a fast field.
#[inline]
pub fn is_fast(&self) -> bool {
self.fast
}
Expand Down
1 change: 1 addition & 0 deletions src/schema/facet_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub struct FacetOptions {

impl FacetOptions {
/// Returns true if the value is stored.
#[inline]
pub fn is_stored(&self) -> bool {
self.stored
}
Expand Down
1 change: 1 addition & 0 deletions src/schema/field_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ impl FieldEntry {
}

/// Returns true if the field is stored
#[inline]
pub fn is_stored(&self) -> bool {
match self.field_type {
FieldType::U64(ref options)
Expand Down
4 changes: 4 additions & 0 deletions src/schema/ip_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,25 @@ pub struct IpAddrOptions {

impl IpAddrOptions {
/// Returns true iff the value is a fast field.
#[inline]
pub fn is_fast(&self) -> bool {
self.fast
}

/// Returns `true` if the ip address should be stored in the doc store.
#[inline]
pub fn is_stored(&self) -> bool {
self.stored
}

/// Returns true iff the value is indexed and therefore searchable.
#[inline]
pub fn is_indexed(&self) -> bool {
self.indexed
}

/// Returns true if and only if the value is normed.
#[inline]
pub fn fieldnorms(&self) -> bool {
self.fieldnorms
}
Expand Down
6 changes: 6 additions & 0 deletions src/schema/json_object_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,20 @@ pub struct JsonObjectOptions {

impl JsonObjectOptions {
/// Returns `true` if the json object should be stored.
#[inline]
pub fn is_stored(&self) -> bool {
self.stored
}

/// Returns `true` iff the json object should be indexed.
#[inline]
pub fn is_indexed(&self) -> bool {
self.indexing.is_some()
}

/// Returns true if and only if the json object fields are
/// to be treated as fast fields.
#[inline]
pub fn is_fast(&self) -> bool {
matches!(self.fast, FastFieldTextOptions::IsEnabled(true))
|| matches!(
Expand All @@ -66,6 +69,7 @@ impl JsonObjectOptions {
}

/// Returns true if and only if the value is a fast field.
#[inline]
pub fn get_fast_field_tokenizer_name(&self) -> Option<&str> {
match &self.fast {
FastFieldTextOptions::IsEnabled(true) | FastFieldTextOptions::IsEnabled(false) => None,
Expand All @@ -87,6 +91,7 @@ impl JsonObjectOptions {
///
/// If disabled, the "." needs to be escaped:
/// `k8s\.node\.id:5`.
#[inline]
pub fn is_expand_dots_enabled(&self) -> bool {
self.expand_dots_enabled
}
Expand All @@ -103,6 +108,7 @@ impl JsonObjectOptions {
/// If set to `Some` then both int and str values will be indexed.
/// The inner `TextFieldIndexing` will however, only apply to the str values
/// in the json object.
#[inline]
pub fn get_text_indexing_options(&self) -> Option<&TextFieldIndexing> {
self.indexing.as_ref()
}
Expand Down
5 changes: 5 additions & 0 deletions src/schema/numeric_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,26 +57,31 @@ impl From<NumericOptionsDeser> for NumericOptions {

impl NumericOptions {
/// Returns true iff the value is stored in the doc store.
#[inline]
pub fn is_stored(&self) -> bool {
self.stored
}

/// Returns true iff the value is indexed and therefore searchable.
#[inline]
pub fn is_indexed(&self) -> bool {
self.indexed
}

/// Returns true iff the field has fieldnorm.
#[inline]
pub fn fieldnorms(&self) -> bool {
self.fieldnorms && self.indexed
}

/// Returns true iff the value is a fast field.
#[inline]
pub fn is_fast(&self) -> bool {
self.fast
}

/// Returns true if values should be coerced to numbers.
#[inline]
pub fn should_coerce(&self) -> bool {
self.coerce
}
Expand Down
5 changes: 5 additions & 0 deletions src/schema/text_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,19 @@ fn is_false(val: &bool) -> bool {

impl TextOptions {
/// Returns the indexing options.
#[inline]
pub fn get_indexing_options(&self) -> Option<&TextFieldIndexing> {
self.indexing.as_ref()
}

/// Returns true if the text is to be stored.
#[inline]
pub fn is_stored(&self) -> bool {
self.stored
}

/// Returns true if and only if the value is a fast field.
#[inline]
pub fn is_fast(&self) -> bool {
matches!(self.fast, FastFieldTextOptions::IsEnabled(true))
|| matches!(
Expand All @@ -91,6 +94,7 @@ impl TextOptions {
}

/// Returns true if and only if the value is a fast field.
#[inline]
pub fn get_fast_field_tokenizer_name(&self) -> Option<&str> {
match &self.fast {
FastFieldTextOptions::IsEnabled(true) | FastFieldTextOptions::IsEnabled(false) => None,
Expand All @@ -101,6 +105,7 @@ impl TextOptions {
}

/// Returns true if values should be coerced to strings (numbers, null).
#[inline]
pub fn should_coerce(&self) -> bool {
self.coerce
}
Expand Down

0 comments on commit 4837c78

Please sign in to comment.