-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search: Return Results for URLs #5936
Comments
Yeah, I've been needing this as well. #4384 (comment) I figured out a few things: Separator (docs) https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-search/?h=separator#special-characters Their default is:
This part: This part: Some parts of this are needed to return any results for
But it also returns results for all instances of Removing Removing |
Thanks for suggesting. I'm not sure that many users need this, but we can definitely let it sit here for a while to collect some feedback. We might consider shipping it with our new search functionality. |
@squidfunk does it need to be a big deal? Can't it be something as "simple" as changing options/code like I listed above? |
I don't think so. From what you write in #5936 (comment), you want to match:
I don't think you can achieve it by just changing the search separator, because currently, you can either have 1. or 2., but not both. You will also match instances of This is one of the reasons why I'm currently rewriting search from scratch. |
Thanks again for suggesting. While I'm not sure whether the general case of adding URLs to indexes is something many users want, I'm confident that I found a good design that allows for defining different separators for different fields: const config: Config<Document> = {
schemas: [
{
kind: "term",
data: {
separator: whitespace, // "foo bar baz" -> "foo", "bar", "baz"
fields: [
{ name: "foo", from: ({ foo }) => foo },
{ name: "baz", from: ({ bar }) => bar?.baz }
]
}
},
{
kind: "term",
data: {
separator: none, // "http://example.com" -> "http://example.com"
fields: [
{ name: "url", from: ({ url }) => url }
]
}
}
]
} This will also allow to index the same terms in different ways, including camel- and pascal-case terms, e.g. |
A further thing that came to my mind: the approach I mentioned above will work for when URLs are provided as metadata, i.e., as a separate field, but not if they are contained in the text. No tokenization separator will allow to cover that. However, we could essentially add a preprocessing step to the text to extract URLs and then index them accordingly. I'm not sure we will offer this functionality from the start, but as long as you specify URLs as metadata to documents ( or use the actual URL of the document for indexing), it should work in the first iteration of the new search. |
Please see the announcement in #6307. |
I invite you to try the 2nd search research preview – I think this should solve the issue at hand: If you add characters to the |
@StephenB87 @MaximilianKohler did any of you check out the research preview? Does it improve results? |
I have been following your progress in these issues but I haven't installed any beta/preview versions. Your screenshots look like the new versions are a full solution though. |
It would be good, to receive some feedback, especially looking at #5936 (comment) which I got no reaction on. It's one thing to raise feature requests or report things that can be improved, but it's another one to provide feedback on solutions that we propose to address those issues 😉 Otherwise, when we release the new version and it does not fully solve what was requested here, it might be too late. That's why we try to get early feedback. |
I didn't quite understand that comment. Do you mean "naked link" (https://squidfunk.github.io/mkdocs-material) vs contained in text? Naked links would be the most important for me, but contained-in-text would be great if possible. I didn't try any of the PRs/betas/tests because I'm not too familiar with switching back and forth between them and the master branch, and I think I read something about it being difficult or problematic. Oh, it might have been this #6372, including your note to not use it in production. Looking at the installation docs I'm not too sure how switching back and forth works. I'm a novice, on Windows, and managed to get the master installed with pip, but I don't understand where it's been installed, how installing a PR would work or replace or conflict with the existing install, where the PR would be and how to use it, etc. That reminds me, I was curious how you made the front page with this and couldn't find the source. Here's why I was curious. I posted that to a few other places but didn't find an answer. |
I added instructions in the research preview:
Additionally, somebody asked how to switch back in the same issue:
Regardless, we'll keep working on this. If the solution we come up with doesn't entirely meet your requirements, you can always customize or fork the theme to get it exactly to your taste |
That's just one command. I realize that command fetches the PR but it doesn't answer my other questions.
Yes, I saw. It doesn't answer my other questions. |
Installing a package with the same name should override the previous one, or detect there is no need to install the version, so it doesn't install, in that case you can add the You can also watch a whole guide on how to setup a development environment if you want to be extra thorough: Most of the questions you asked, are one or 2 google/chatgpt searches away, and I'm not sure if they are in scope of the material theme's documentation.
Searching the discussions board (including closed discussions) for
The landing page is a custom addition for the theme's documentation, the source code can be viewed by sponsors with access to Insiders. The images are under a special licence and can't be reused iirc. It's not a supported feature, just a customization so there is no easy configuration settings for it. EDIT: Fixup for the "It's not a supported feature". The custom home page is supported, with custom templates, and an example is provided in the community version:
|
Context
A user should be able to search for a URL and the return results should match that URL. For example, if I am searching for
https://example1.abc.com/
, the results should match the entire URL. Currently, they do not match, when using default settings for the search plugin:Description
When searching for a URL, the results that are returned should match the entire URL string. For example, if I am searching for
https://example1.abc.com/
, the results should match the entire URL, nothttps
,example1
,xyz
com
. See screenshot above for context.Related links
Use Cases
Site search plugin can be further enhanced to return match results for URLs. Many organizations have documentation that contains multiple URLs. Someone might not know what the URL is for, but if they can search the URL they can find relevant documentation.
Visuals
No response
Before submitting
The text was updated successfully, but these errors were encountered: