Interface QueryStringBuilder

interface QueryStringBuilder {
    and(): this;
    or(): this;
    exact(): this;
    noExact(): this;
    exclude(): this;
    noExclude(): this;
    terms(term: string, ...terms: string[]): this;
    named(name: string, term: string, ...terms: string[]): this;
    label(label: string, ...labels: string[]): this;
    categories(category: string, ...categories: string[]): this;
    labels(label: string, ...labels: string[]): this;
    author(author: string, ...authors: string[]): this;
    title(title: string, ...titles: string[]): this;
    build(): MaybeString;
}

Methods

  • Changes the operator to append search terms to AND.

    Returns this

    builder
    .labels('first')
    .and()
    .labels('second')
    .build() // 'label:first label:second'
  • Changes the operator to append search terms to OR.

    Returns this

    builder
    .labels('first')
    .or()
    .labels('second')
    .build() // 'label:first|label:second'
  • Sets the exact mode on.

    The next search terms will be exact.

    Returns this

    builder
    .labels('first')
    .and().exact()
    .labels('second label') // for labels with spaces, It's recommended to use exact mode.
    .build() // 'label:first label:"second label"'
  • Sets the exact mode off.

    The next search terms will not be exact.

    Returns this

    builder
    .exact()
    .labels('first label') // for labels with spaces, It's recommended to use exact mode.
    .or().noExact()
    .labels('second')
    .build() // 'label:"first label"|label:second'
  • Sets the exclude mode on.

    The next search terms will be exclusive.

    Returns this

    builder
    .labels('first')
    .and().exclude()
    .labels('second')
    .build() // 'label:first -label:second'
  • Sets the exclude mode off.

    The next search terms will not be exclusive.

    Returns this

    builder
    .labels('first')
    .and().exclude()
    .labels('second')
    .noExclude()
    .labels('third')
    .build() // 'label:first -label:second label:third'
  • Appends search terms to the query.

    Parameters

    • term: string

      The search term.

    • Rest...terms: string[]

      Other search terms.

    Returns this

    builder
    .terms('search', 'terms')
    .build() // 'search|terms'
  • Appends named search terms to the query.

    Parameters

    • name: string

      The name of the search terms.

    • term: string

      The search term.

    • Rest...terms: string[]

      Other search terms.

    Returns this

    builder
    .named('label', 'search', 'label')
    .build() // 'label:search|label:label'
  • Appends label search terms to the query.

    Parameters

    • label: string

      The label names.

    • Rest...labels: string[]

      Other label names

    Returns this

    builder.label(label) // .named('label', label)
    

    1.2

  • Appends category search terms to the query.

    Parameters

    • category: string

      The category name.

    • Rest...categories: string[]

      Other category names.

    Returns this

    This is an alias for label

  • Appends label search terms to the query.

    Parameters

    • label: string

      The label name.

    • Rest...labels: string[]

      Other label names.

    Returns this

    This is an alias for label

  • Appends author search terms to the query.

    Parameters

    • author: string

      The author name.

    • Rest...authors: string[]

      Other author names.

    Returns this

    builder.author(author) // .named('author', author)
    

    1.2

  • Appends title search terms to the query.

    Parameters

    • title: string

      The entry title.

    • Rest...titles: string[]

      Other entry titles.

    Returns this

    builder.title(title) // .title('title', title)
    

    1.2

  • Returns the built query string. If It's empty, an undefined value is returned.

    Returns MaybeString