Table of Contents

Class ChatAdminQuery

Namespace
FishMMO.Database.Data
Assembly
FishMMO-DB.dll

The filter an operator chat search applies.

public sealed class ChatAdminQuery
Inheritance
ChatAdminQuery
Inherited Members

Remarks

An object rather than a parameter list, for the reason AccountAdminQuery gives: eight optional filters as positional arguments is eight chances to transpose two of them at a call site where both are strings and nothing complains.

Every filter is optional and null means "do not narrow on this", with one exception that the service enforces rather than the type: see Text.

Fields

DefaultPageSize

The page size used when a caller asks for none.

public const int DefaultPageSize = 50

Field Value

int

Remarks

Fifty, rather than the twenty-five an account search uses: a conversation is read in sequence, and a page that ends mid-exchange makes an operator page back and forth to reconstruct it.

MaxPageSize

The largest page the service will return, whatever is asked for.

public const int MaxPageSize = 200

Field Value

int

Remarks

The cap exists because the page size is the only part of this query a caller controls that has no upper bound of its own: every other filter can only narrow the result, while pageSize=1000000 asks the server to materialize the table.

Properties

AccountName

Exact account name to match, or null for any account.

public string? AccountName { get; set; }

Property Value

string

Remarks

The account filter is what catches somebody using a second character to continue the same harassment, which is why it is separate from CharacterName rather than one combined "who" box.

Channel

Exact ChatChannel value to match, or null for every channel.

public byte? Channel { get; set; }

Property Value

byte?

Remarks

A byte rather than the enum so an unrecognised channel can still be searched for, and so a caller parsing a query string does not have to know the enum to pass one through.

CharacterName

Exact character name to match, or null for any sender.

public string? CharacterName { get; set; }

Property Value

string

Remarks

Exact, not a prefix, and there is no index behind it — see the search implementation. An operator handling a report has the name in front of them, copied from the report, so matching it exactly costs them nothing and keeps the scan it forces as narrow as it can be.

FromUtc

Inclusive lower bound on TimeCreated, or null.

public DateTime? FromUtc { get; set; }

Property Value

DateTime?

Remarks

This is the bound that actually narrows a search: it is the one an index on time_created can start a range scan from. ToUtc alone cannot.

HasNarrowingFilter

Whether this query narrows the search by something other than the message text.

public bool HasNarrowingFilter { get; }

Property Value

bool

Remarks

Deliberately does not count ToUtc or Channel. An upper time bound with no lower bound spans the whole history up to that instant, and a channel filter divides the table by a ten-valued column where the common values hold most of the rows — neither one turns a scan into anything smaller. Counting them would make the guard below feel satisfied while changing nothing about what the database does.

Page

1-based page number.

public int Page { get; set; }

Property Value

int

PageSize

Rows per page. Clamped by the service, whatever is asked for.

public int PageSize { get; set; }

Property Value

int

Text

Substring the message must contain, or null for no text filter.

public string? Text { get; set; }

Property Value

string

Remarks

A substring, unlike Query, which is a prefix precisely to stay index-serviceable. There is no prefix version of this filter that answers the question: a report says "they called me <slur>", and the slur is in the middle of the sentence. So this one accepts the leading wildcard it needs.

What it does not accept is being the ONLY filter. Supplied alone, it is refused with a validation error rather than silently bounded; see the search implementation for why refusing beats defaulting.

ToUtc

Exclusive upper bound on TimeCreated, or null.

public DateTime? ToUtc { get; set; }

Property Value

DateTime?

Remarks

Exclusive so that two adjacent windows tile without a row appearing in both, matching the convention AdminAuditService.SearchAsync already set.