CommunitySearch¶
Namespace Nfty.Core.Publish.Community in assembly Nfty.Core.
The one search box: #tag, @user and plain words, combined with AND. The text is the only source of truth, so clicking a tag chip, a tile's owner or a tag link just edits the text with CommunitySearch.Toggle().
Methods¶
Has(string?, string)¶
Whether the text carries token as one of its terms (ignoring case).
Parameters
text(string?) - The box's text.token(string) - The token.
Returns. True when the token is one of the terms.
Matches(CommunityEntry, CommunityQuery)¶
Whether an entry satisfies every term of the query. An empty query matches everything.
Parameters
entry(CommunityEntry) - The entry.query(CommunityQuery) - The parsed search.
Returns. True when the entry satisfies every term.
Parse(string?)¶
Splits the box's text on whitespace into tags, owners and words. A lone # or @ is ignored.
Parameters
text(string?) - What the user typed; null reads as empty.
Returns. The tags, owners and words the text names.
Toggle(string?, string)¶
Adds token to the text when it is not there, removes it when it is, and leaves single spaces.
Parameters
text(string?) - The box's text.token(string) - The token, such as#petsor@alice. Compared ignoring case.
Returns. The text with the token added or removed.