{ "name": "Search", "script": "Search.js", "version": "0.1.1", "description": "Search provides full text searching across handouts and characters (including attributes). Search uses an Okapi BM25F+ search engine with Porter stemming and stop word removal to provide fast results after building initial indexes. Index construction occurs at API startup, in the background. The GM is notified when indexing is finished. Indexing can take a few minutes, but won't slow down any other processes due to a great deal of deferring of processing.\r\rSearch respects permissions on handouts and characters. GMs can search on all things, where as players can only search based on what they can see. Seeing a handout allows a player to search on it's `name` and `notes` fields. Seeing a character allows a player to search on it's `name` and `bio` fields. Controlling a character allows searching on it's `attribute`s as well. Only GMs can search on `gmnotes`.\r\r## Commands\r\r```!search --help|--reindex|```\r\rThe interface to searching.\r\r* `--help` -- Displays this help in game.\r* `--reindex` -- Rebuilds the search index. This can take a minute or two and is only necessary when you've made changes (like permissions) (GM Only).\r* `` -- a collection of terms and modifiers to define what is important. See **Search Query** below for full details. \r___\r## Search Query\rAt it's simplest, a Search Query is just a list of words you're interested in:\r```\r!search sun blade\r```\r\r### Terms\r\rThere are 6 basic ways to enter terms:\r* `term` -- Just a bare word will rank as normal.\r* `+term` -- Prepending with `+` marks a word as **important**, and it will be weighted double.\r* `-term` -- Prepending with `-` marks a word as **detracting**, and it's weight will be subtracted, lowering the document's score.\r* `*term` -- Prepending with `*` marks a word as **required**, and a document will be rejected if it doesn't have a match.\r* `~term` -- Prepending with `~` marks a word as **prohibited**, and a document with a match will be rejected.\r* `term^N` -- Appending a `^` with a number will multiply the weight of a term by that number. Numbers can be proceeded by a - to make the term detract, and may have a decimal place. The leading zero may be omitted.\r\rHere is an example using each modifier:\r```\r!search knight *king ~queen +prince -princess chamberlain^1.1 maid^-.3\r```\rThis will search for `knight`, require a match for `king`, reject any document that matches `queen`, reduce the score of for matching `princess`, rank `chamberlain` 1.1 times higher than normal and reduce the score for matching `maid` at about 1/3 the weight.\r\rPrepended modifiers can also be combine with direct weighting:\r```\r!search *king^.5 throne\r```\rMust match `king`, but at half it's relative weight. `throne` is weighted normally.\r\r### Fields\rYou can specify search terms to apply only to a specific field using the `in:` syntax:\r\r```\r!search in:bio parents\r```\rSearches for `parents` in just the `bio` field. \r\rThe `in:` syntax only applies to the next term listed.\r\r```\r!search in:bio parents dragon\r```\rSearches for `parents` in jut the `bio` field, and dragon in any field.\r\rIf you want to search for multiple terms in a field, you can surround them in parenthsis:\r\r```\r!search in:bio ( parents siblings brother sister )\r```\rSearch for `parents`, `siblings`, `brother`, and `sister` in the `bio` field.\r\rAnywhere you place terms, you can apply modifiers:\r```\r!search in:bio ( parents siblings +brother sister^3 )\r```\rAdditionally, you can apply the same modifiers to the `field` name to apply them to all the specified terms:\r```\r!search in:bio^2 ( brother sister ) dragon\r```\rBoth `sister` and `brother` in the `bio` field are weighted double what `dragon` is in all fields.\r\rYou can specify different weighting for terms in a `field` and out of it:\r```\r!search in:bio ( +dragon ) dragon\r```\rThe most spcific rule is applied. `dragon` in `bio` will be ranked double what `dragon` elsewhere is.\r\rIf you modify the `field` and the `term`, they are combined in the ways you would expected:\r\r```\r!search in:+bio ( +dragon wyvern ) dragon wyvern\r```\r`dragon` in bio is x4, `wyvern` in bio is x2, `dragon` and `wyvern` elsewhere are normally weighted.\r\r### Categories\r\rYou can specify search terms to apply only to a specific category using the `on:` syntax:\r```\r!search on:handout gemstone\r```\rSearch for `gemstone` in all fields of `handout`s.\r\rJust like with `in:`, you can use parenthesis to group terms:\r```\r!search on:character( knight paladin )\r```\rSearch for `knight` and `paladin` in all fields of `character`s.\r\rAlso like `field`s, the `category` can be modified just like `term`s and passes the modifications down the same way.\r```\r!search on:character^1.2( knight paladin ) knight paladin\r```\r`knight` and `paladin` are ranked x1.2 when on a `character`.\r\rYou can nest `in:` rules in `on:` rules.\r```\r!search on:character^1.3( in:name +dragon dragon ) dragon\r```\r`dragon` in character name is worth x2.6, elsewhere on character is worth x1.2, and anywhere else is worth normal.\r\rYou can get as complicated as you like with this.\r```\r!search on:character( in:name( dragon -wyvern ~snake) +snake in:gmnotes^3 secret ) on:handout( *treasure *gold )\r```\rSearch for characters with `dragon`, preverably not `wyvern`, and flat out not metion of `snake` in the name, but rank higher for `snake` elsewhere and `secret` in gmnotes is x3. Also include any handouts that mention both `treasure` and `gold`.\r\r## Results\r\rThe results are sorted based on the combination of the weights of all the terms they matched, then the top 30 are whispered to the user in the chat.\r\rEach result row contains a circle with an **H** for handout or **C** for character, followed by the name of the matching document with the folder it is in in smaller lettering above it. The name of the document is a link that will open it. At the top right is the total score for the document. Along the bottom of each row are the terms the document matched, with the number of unique fields it matched in, followed by the portion of the score it contributed. This is followed by a list of fields with the number of unique terms matched and the contribution to the score. Looking at these details can help you fine tune your search.", "authors": "The Aaron", "roll20userid": "104025", "patreon": "https://www.patreon.com/shdwjk", "useroptions": {}, "dependencies": {}, "modifies": { "state.Search": "read,write" }, "conflicts": [], "previousversions": [ "0.1.0" ] }