Extra Networks Search
Search input for the extra networks accepts additional search syntax. This allows to do more complicated searches, in addition to the searches which were previously available.
Search Syntax
In a normal search, there are 3 special symbols which can be used to modify the search:
|
- Or, it allows to search for one of multiple terms at once (or exclude multiple terms, if prefixed with-
)-
- Exclude, terms or phrases prefixed with this symbol will be excluded from the search&
- And, require all terms to be present (or not present, if prefixed with-
) in the search results
These symbols are parsed in the order of |
, &
, -
. This means that a|b&c
is equivalent to "a or [b and c]" and a&b|c
is equivalent to "[a and b] or c".
It is not possible to modify the order of operations with parentheses or other symbols.
Whitespace (this means spaces, tabs, newlines, etc.) is trimmed from individual terms.
This means that a | b
is equivalent to a|b
.
Also a|-b
is equivalent to a| - b
.
Search is case-insensitive, this means that a
is equivalent to A
.
However this concept might be clearer with a few examples based on a list of networks.
Examples
Assume the following folder structure for your networks:
├── SDXL/
│ ├── Clothing/
│ │ ├── Elegant Gown.safetensor
│ │ ├── Vintage Suit.safetensor
│ │ ├── Summer Dress.safetensor
│ │ └── Sports Attire.safetensor
│ ├── Concept/
│ │ ├── Futuristic Cityscape.safetensor
│ │ ├── Underwater World.safetensor
│ │ ├── Space Exploration.safetensor
│ │ └── Cyberpunk Street.safetensor
│ └── Person/
│ ├── Celebrity Portrait.safetensor
│ ├── Historical Figure.safetensor
│ ├── Fictional Character.safetensor
│ └── Movie Star.safetensor
└── SD1.5/
├── Clothing/
│ ├── Casual Wear.safetensor
│ ├── Casual Winter-Wear.safetensor
│ ├── Winter Coat.safetensor
│ ├── Evening Gown.safetensor
│ └── Vintage Suit.safetensor
├── Concept/
│ ├── Alien Landscape.safetensor
│ ├── Medieval Castle.safetensor
│ ├── Cyberpunk Street.safetensor
│ └── Futuristic Cityscape.safetensor
└── Person/
├── Scientist Portrait.safetensor
├── Movie Star.safetensor
├── Mythological Hero.safetensor
└── Historical Figure.safetensor
Below are some example queries, which are explained in detail afterwards.
Vintage Suit
- Search for everything which contains the phraseVintage Suit
, meaning in this caseVintage Suit.safetensor
inSDXL
andVintage Suit.safetensor
inSD1.5
.clothing
- Search for everything which contains the wordclothing
, meaning in this case all networks in theClothing
folders.clothing & SDXL
- Search for everything which contains the wordclothing
and the wordSDXL
, meaning in this case all networks in theClothing
folder of theSDXL
folder.-SD1.5
- Search for everything which does not contain the wordSD1.5
, meaning in this case all networks in theSDXL
folder.gown | dress
- Search for everything which contains the wordgown
or the worddress
, meaning in this caseEvening Gown.safetensor
inSD1.5
andElegant Gown.safetensor, Summer Dress.safetensor
inSDXL
.SDXL & gown | SDXL & dress
- Search for everything which contains the wordgown
or the worddress
and the wordSDXL
, meaning in this just caseElegant Gown.safetensor, Summer Dress.safetensor
inSDXL
.clothing | - Casual Wear
- Search for everything which contains the wordclothing
, as long as it does not contain the phraseCasual Wear
, meaning in this caseCasual Winter-Wear.safetensor, Elegant Gown.safetensor, Vintage Suit.safetensor, Summer Dress.safetensor, Sports Attire.safetensor
inSDXL
andEvening Gown.safetensor, Vintage Suit.safetensor, Winter Coat
inSD1.5
.clothing | - Casual & Wear
- Search for everything which contains the wordclothing
, as long as it does not contain both the wordcasual
and the wordwear
, meaning in this caseElegant Gown.safetensor, Vintage Suit.safetensor, Summer Dress.safetensor, Sports Attire.safetensor
inSDXL
andEvening Gown.safetensor, Vintage Suit.safetensor, Winter Coat.safetensor
inSD1.5
(Note thatCasual Winter-Wear.safetensor
is excluded from the search results).clothing | -black | - gray | -white
- Search for everything which contains the wordclothing
, as long as it does not contain the wordsblack
,gray
orwhite
.SDXL | -Turbo | -LCM
- Search for everything which contains the word SDXL, as long as it does not contain the wordsTurbo
orLCM
. Can be used to filter different types of networks.SDXL & Turbo | SDXL & LCM
- The inverse of the previous search. Search for everything which contains the wordTurbo
orLCM
and the wordSDXL
.
Advanced usage
It is also possible to do a RegEx search instead of a normal search.
To do so, the search term has to be prefixed with r#
.
Everything after that will be interpreted as a RegEx search.
This means that r#.*
will match everything, r#^$
will match nothing and r#a
will match everything which contains the letter a
.
Please watch out that valid RegEx syntax is used, otherwise the search will fail.
In addition to that, the RegEx search is also slower than a normal search, so it is recommended to only use it if necessary.
RegEx searches are case-insensitive too.
One more thing to watch out for, is file paths. For the normal search the Windows \
is replaced with a /
to make it easier to search for file paths. This is not the case for the RegEx search. So you could use for example [\/\\]
to match both \
and /
in a RegEx search.
Considering the RegEx search, the field which is searched is structured in the following way:
`filename: ${filename}|name: ${name}|tags: ${tags}`
As of writing this, the fields represent the following:
name
- The relative path to the network, not including filetype (also shows when hovering the network card for a longer time)filename
- The absolute path to the network. (This does not resolve symlinks, so the path shown is the path to the symlink if one is used, not the path to the file the symlink points to)tags
- The tags the network has, separated by|
. Not all networks necessarily have tags, and they can be either keywords used when prompting, or the keyword to trigger the network specifically.
This allows to exclude (or include) certain strings only in specific fields. For example a negative lookahead can be used to exclude certain tags from the search, while still searching for them in the title.
An example RegEx would be the following for this use case:
r#^(?!.*\|tags:.*(1girl|woman|girl)).*$
This search excludes every network which has tags which contain either 1girl
, woman
or girl
.
Another usecase would be searching in just the filename, but not in the entire path.
For example requiring the network to contain SDXL
, with it not mattering whether it is in a folder called SDXL
or not:
r#^.*\|name:[^|]*([^\/\\]*SDXL[^\/\\]*)$(?<![\/\\]).*$
As this is already advanced usage, the assumption is made that the user knows how to use RegEx, so no further examples or explanations of the provided RegEx are given here. Tools like https://regex101.com/ can be used to create, test, understand and debug a regular expression.