1
Fork 0
mirror of https://github.com/Steffo99/patched-porobot.git synced 2024-12-23 01:54:22 +00:00

Improve significantly docs

This commit is contained in:
Steffo 2022-08-08 21:06:52 +02:00
parent d2f922b97f
commit bc05fc9afa
Signed by: steffo
GPG key ID: 6965406171929D01
3 changed files with 75 additions and 23 deletions

View file

@ -6,18 +6,71 @@
//! //!
//! [@patchedporobot] is a inline bot: this means that you can use it everywhere, without having to add it to chats. //! [@patchedporobot] is a inline bot: this means that you can use it everywhere, without having to add it to chats.
//! //!
//! ### Basic queries
//!
//! You can search for a card by entering in the "Write a message..." bot the username of the bot, followed by the card you want to search for: //! You can search for a card by entering in the "Write a message..." bot the username of the bot, followed by the card you want to search for:
//!
//! ```text //! ```text
//! @patchedporobot braum //! @patchedporobot braum
//! ``` //! ```
//!
//! You can specify multiple words to find cards that contain all of them:
//!
//! ```text //! ```text
//! @patchedporobot poro //! @patchedporobot mighty poro
//! ```
//! ```text
//! @patchedporobot noxus
//! ``` //! ```
//! //!
//! Terms will be searched in multiple fields, so to find [Daring Poro](https://leagueoflegends.fandom.com/wiki/Daring_Poro_(Legends_of_Runeterra)) you may search for:
//! //!
//! ```text
//! @patchedporobot piltover poro
//! ```
//!
//! ### Conjunctions
//!
//! By default, all terms in the query are joined by `AND` conjuctions, meaning that only cards containing **all** of the terms are retrieved.
//!
//! If you want to find cards matching **any** of the terms, you'll have to manually join them with the `OR` conjuction:
//!
//! ```text
//! @patchedporobot progress OR heimerdinger
//! ```
//!
//! To have both `AND`s and `OR`s in the same query you'll need to specify all of them explicitly:
//!
//! ```text
//! @patchedporobot von AND yipp OR cat
//! ```
//!
//! ### Fields
//!
//! You can perform searches about specific card properties:
//!
//! ```text
//! @patchedporobot cost:4 attack:7 health:7
//! ```
//!
//! Conjunctions are supported even when searching by specific fields:
//!
//! ```text
//! @patchedporobot name:Bard OR description:Chime
//! ```
//!
//! #### Supported fields
//!
//! [@patchedporobot] supports the various fields for searching cards: see [**this table**](patched_porobot::search::cardsearch::CardSearchEngine::schema) for a list of all of them!
//!
//! ### Ranges
//!
//! Finally, you can request specific ranges for your search using square brackets and the `TO` keyword:
//!
//! ```text
//! @patchedporobot attack:[8 TO 12]
//! ```
//!
//! ### Query parser
//!
//! Since [@patchedporobot] uses [`tantivy`] internally, you might find more information on even more advanced queries in the [documentation of their `QueryParser`](tantivy::query::QueryParser)!
//! //!
//! //!
//! [@patchedporobot]: https://t.me/patchedporobot //! [@patchedporobot]: https://t.me/patchedporobot

View file

@ -107,24 +107,24 @@ impl CardSearchEngine {
/// ///
/// It will contain [Field]s with the following names: /// It will contain [Field]s with the following names:
/// ///
/// | Name | Type | /// | Name | Type | Description |
/// |---------------|----------------------------------| /// |---------------|----------------------------------|-------------|
/// | `code` | [code](Self::options_code) | /// | `code` | [code](Self::options_code) | The internal [card code](Card::code), such as `01IO012`. |
/// | `name` | [text](Self::options_text) | /// | `name` | [text](Self::options_text) | The [name of the card](Card::name). |
/// | `type` | [keyword](Self::options_keyword) | /// | `type` | [keyword](Self::options_keyword) | The [type of the card](Card::type), such as `Unit`. |
/// | `set` | [keyword](Self::options_keyword) | /// | `set` | [keyword](Self::options_keyword) | The [set the card belongs to](Card::set), such as `Beyond the Bandlewood`. |
/// | `rarity` | [keyword](Self::options_keyword) | /// | `rarity` | [keyword](Self::options_keyword) | The [rarity of the card](patched_porobot::data::setbundle::card::Card::rarity), such as `Rare`, or `Champion`. |
/// | `collectible` | [number](Self::options_number) | /// | `collectible` | [number](Self::options_number) | `1` if the [card is collectible](Card::collectible), `0` otherwise. |
/// | `regions` | [keyword](Self::options_keyword) | /// | `regions` | [keyword](Self::options_keyword) | The [regions of the card](Card::regions), separated by spaces. |
/// | `attack` | [number](Self::options_number) | /// | `attack` | [number](Self::options_number) | The [attack of the unit](Card::attack); always `0` for non-units. |
/// | `cost` | [number](Self::options_number) | /// | `cost` | [number](Self::options_number) | The [mana cost of the card](Card::cost); always `0` for non-playable cards. |
/// | `health` | [number](Self::options_number) | /// | `health` | [number](Self::options_number) | The [health of the unit](Card::health); always `0` for non-units. |
/// | `spellspeed` | [keyword](Self::options_keyword) | /// | `spellspeed` | [keyword](Self::options_keyword) | The [speed of the spell](Card::spell_speed), or an empty string for non-spells. Note that [`Focus`](crate::data::setbundle::keyword::CardKeyword::Focus) is a keyword, and not a spell speed. |
/// | `keywords` | [keyword](Self::options_keyword) | /// | `keywords` | [keyword](Self::options_keyword) | The [keywords of the card](Card::keywords), separated by spaces. |
/// | `description` | [text](Self::options_text) | /// | `description` | [text](Self::options_text) | The [description of the card](Card::localized_description_text). |
/// | `levelup` | [text](Self::options_text) | /// | `levelup` | [text](Self::options_text) | The [level up text of the champion](Card::localized_levelup_text). |
/// | `flavor` | [text](Self::options_text) | /// | `flavor` | [text](Self::options_text) | The [flavor text of the card](Card::localized_flavor_text). |
/// | `artist` | [text](Self::options_text) | /// | `artist` | [text](Self::options_text) | The [artist(s) of the card's illustration](Card::artist_name). |
/// ///
/// Use [Self::schema_fields] to create the [CardSchemaFields] object containing all of them. /// Use [Self::schema_fields] to create the [CardSchemaFields] object containing all of them.
/// ///

View file

@ -1 +0,0 @@
# Test