Search - General Questions #2861
-
Question 1 - Search "Fields"Lunr has the notion of: idx.search('title:foo* bar') In mkdocs-material' case, this works well, awesome However, I couldn't find any other "fields" that mkdocs-material is currently leveraging. Question 2 - Searching Fenced CodeFor instance: sudo anything here Is not visible in search. This is where Question 1 comes to play For example I would like to search a command I forgot like sudo -H pip install --ignore-installed six --upgrade six By using a search like code:sudo -H pip install * Again this works great if I know the available fields. title:sudo -H pip install Is great, but only if that was in a title (h1, h2, h3 etc.), which it sometimes is, but normally isn't. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Question 1 - Search "Fields"Searchable fields are:
Note that the syntax demands for prefixing every word with the field, i.e.
... or let Material for MkDocs preprocess the query string and use quotes as known from Google:
Why is this not documented? I think you very much see how complex and ugly the syntax is and most users just don't bother. My goal is to provide a search implementation that returns good results with simple keyword search and presents them in a way so that you can quickly skim through the results, thus omitting the need for explanation. Question 2 - Searching Fenced CodeCode blocks are just converted to regular text when MkDocs is building the index, so there're no remnants of "hey, this is text inside a code block". One would have to monkey-patch the search plugin to somehow set markers and allow for dedicated indexing of code examples. If you look into |
Beta Was this translation helpful? Give feedback.
Question 1 - Search "Fields"
Searchable fields are:
title
text
tags
(currently Insiders only)Note that the syntax demands for prefixing every word with the field, i.e.
title:foo title:bar
, becausetitle:foo bar
means "documents withfoo
intitle
andbar
in any field". This will, however, yield anOR
search. If you want anAND
search, you would have to search like this:... or let Material for MkDocs preprocess the query string and use quotes as known from Google:
Why is this not documented? I think you very much see how complex and ugly the syntax is and most users just don't bother. My goal is to provide a search implementation that returns…