pub struct DocumentQuery {
    pub query: String,
    pub is_nl_query: bool,
    pub custom_property_filter: String,
    pub time_filters: Vec<TimeFilter>,
    pub document_schema_names: Vec<String>,
    pub property_filter: Vec<PropertyFilter>,
    pub file_type_filter: Option<FileTypeFilter>,
    pub folder_name_filter: String,
    pub document_name_filter: Vec<String>,
    pub query_context: Vec<String>,
    pub document_creator_filter: Vec<String>,
    pub custom_weights_metadata: Option<CustomWeightsMetadata>,
}

Fields§

§query: String

The query string that matches against the full text of the document and the searchable properties.

The query partially supports Google AIP style syntax. Specifically, the query supports literals, logical operators, negation operators, comparison operators, and functions.

Literals: A bare literal value (examples: “42”, “Hugo”) is a value to be matched against. It searches over the full text of the document and the searchable properties.

Logical operators: “AND”, “and”, “OR”, and “or” are binary logical operators (example: “engineer OR developer”).

Negation operators: “NOT” and “!” are negation operators (example: “NOT software”).

Comparison operators: support the binary comparison operators =, !=, <, >, <= and >= for string, numeric, enum, boolean. Also support like operator ~~ for string. It provides semantic search functionality by parsing, stemming and doing synonyms expansion against the input query.

To specify a property in the query, the left hand side expression in the comparison must be the property ID including the parent. The right hand side must be literals. For example: “"projects/123/locations/us".property_a < 1” matches results whose “property_a” is less than 1 in project 123 and us location. The literals and comparison expression can be connected in a single query (example: “software engineer "projects/123/locations/us".salary > 100”).

Functions: supported functions are LOWER(\[property_name\]) to perform a case insensitive match and EMPTY(\[property_name\]) to filter on the existence of a key.

Support nested expressions connected using parenthesis and logical operators. The default logical operators is AND if there is no operators between expressions.

The query can be used with other filters e.g. time_filters and folder_name_filter. They are connected with AND operator under the hood.

The maximum number of allowed characters is 255.

§is_nl_query: bool

Experimental, do not use. If the query is a natural language question. False by default. If true, then the question-answering feature will be used instead of search, and result_count in [SearchDocumentsRequest][google.cloud.contentwarehouse.v1.SearchDocumentsRequest] must be set. In addition, all other input fields related to search (pagination, histograms, etc.) will be ignored.

§custom_property_filter: String
👎Deprecated

This filter specifies a structured syntax to match against the [PropertyDefinition].[is_filterable][] marked as true. The syntax for this expression is a subset of SQL syntax.

Supported operators are: =, !=, <, <=, >, and >= where the left of the operator is a property name and the right of the operator is a number or a quoted string. You must escape backslash (\) and quote (") characters. Supported functions are LOWER(\[property_name\]) to perform a case insensitive match and EMPTY(\[property_name\]) to filter on the existence of a key.

Boolean expressions (AND/OR/NOT) are supported up to 3 levels of nesting (for example, “((A AND B AND C) OR NOT D) AND E”), a maximum of 100 comparisons or functions are allowed in the expression. The expression must be < 6000 bytes in length.

Sample Query: (LOWER(driving_license)="class \"a\"" OR EMPTY(driving_license)) AND driving_years > 10

§time_filters: Vec<TimeFilter>

Documents created/updated within a range specified by this filter are searched against.

§document_schema_names: Vec<String>

This filter specifies the exact document schema [Document.document_schema_name][google.cloud.contentwarehouse.v1.Document.document_schema_name] of the documents to search against.

If a value isn’t specified, documents within the search results are associated with any schema. If multiple values are specified, documents within the search results may be associated with any of the specified schemas.

At most 20 document schema names are allowed.

§property_filter: Vec<PropertyFilter>

This filter specifies a structured syntax to match against the [PropertyDefinition.is_filterable][google.cloud.contentwarehouse.v1.PropertyDefinition.is_filterable] marked as true. The relationship between the PropertyFilters is OR.

§file_type_filter: Option<FileTypeFilter>

This filter specifies the types of files to return: ALL, FOLDER, or FILE. If FOLDER or FILE is specified, then only either folders or files will be returned, respectively. If ALL is specified, both folders and files will be returned.

If no value is specified, ALL files will be returned.

§folder_name_filter: String

Search all the documents under this specified folder. Format: projects/{project_number}/locations/{location}/documents/{document_id}.

§document_name_filter: Vec<String>

Search the documents in the list. Format: projects/{project_number}/locations/{location}/documents/{document_id}.

§query_context: Vec<String>

For custom synonyms. Customers provide the synonyms based on context. One customer can provide multiple set of synonyms based on different context. The search query will be expanded based on the custom synonyms of the query context set. By default, no custom synonyms wll be applied if no query context is provided. It is not supported for CMEK compliant deployment.

§document_creator_filter: Vec<String>

The exact creator(s) of the documents to search against.

If a value isn’t specified, documents within the search results are associated with any creator. If multiple values are specified, documents within the search results may be associated with any of the specified creators.

§custom_weights_metadata: Option<CustomWeightsMetadata>

To support the custom weighting across document schemas, customers need to provide the properties to be used to boost the ranking in the search request. For a search query with CustomWeightsMetadata specified, only the RetrievalImportance for the properties in the CustomWeightsMetadata will be honored.

Trait Implementations§

source§

impl Clone for DocumentQuery

source§

fn clone(&self) -> DocumentQuery

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DocumentQuery

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for DocumentQuery

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Message for DocumentQuery

source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
source§

fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message to a buffer. Read more
source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
source§

fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
source§

fn decode<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes an instance of the message from a buffer. Read more
source§

fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes a length-delimited instance of the message from the buffer.
source§

fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
source§

fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
source§

impl PartialEq for DocumentQuery

source§

fn eq(&self, other: &DocumentQuery) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for DocumentQuery

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromRef<T> for T
where T: Clone,

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more