Open smalers opened 3 years ago
This is now a high priority item given that InfoMapper sites can be complex and we are trying to encourage more use. Below are some thoughts on the design.
The content that needs to be searched must have a URL corresponding to the content. We also want to separate the concerns so that content can stand on its own. In some cases, the searchable content can explicitly indicate keywords and in others it cannot, as discussed below.
keywords : [ "keyword1", "key word 2" ]
. These can be explicit searched. The search results can use the map title and the content type can be "Map".keywords
property in the configuration that links the documentation. For example, the application configuration file could allow this. This makes the content less stand-alone, but is perhaps appropriate when the content does not make sense on its own. I would avoid this for now in favor of the Markdown content.It would be good if the code in the InfoMapper was not overly hard-coded. For example, using the concepts of an interface would be good, something like "implements keyword search". Then, as we add components with content, the search tool would just need to check if a behavior is implemented and if so call the function. The results that are returned will need to be standardized so they can be accumulated into the overall results. It is not clear how the scoping of URLs would be handled in that case. Are they relative URLs (relative to the app location?), absolute URLs (less flexible, especially if the site is moved).
The software to walk the application will need to read the application configuration file and then dig into components. Although this could be run at any time in the InfoMapper, it may make sense to do it as a tool in the InfoMapper Builder, or in a GeoProcessor command. Being able to automate would be good to keep the search index up to date. Similar concepts apply to the sitemap page generator, which can be used for troubleshooting. Both artifacts would allow search engines to index static content. It is OK to develop the code in InfoMapper (Builder) for now and we'll see where it goes.
Add keywords
property to the top level GeoMapProject element as an array of strings.
The first commit for the global search has been merged and pushed. The searchable items right now are
Content Pages - To successfully add the content page's markdown content to the search index, the title of each markdown file must be parsed out and must follow the pattern:
# Some Title #
If the title is not surrounded by hashes on either side, a warning message will be printed to the DevTools window that the file's content's were not added to the search index.
Maps - The keywords
property in the map config's top level GeoMapProject element is an array of strings. Each of these strings will contain the keywords associated with this map, and the Lunr search package will add a boosted score for each found, as they will mean more than words found in markdown file Content Pages. An example of a map's GeoMapProject element could look something like the folowing:
{
"geoMapProjectId": "...",
"name": "...",
"description": "...",
"projectType": "...",
"properties": {
"author": "...",
"specificationFlavor": "...",
"specificationVersion": "..."
},
"keywords": [
"Ditch service areas",
"Water districts raster",
"Colorado municipal boundaries",
"Polygon geometry map"
],
"geoMaps": []
}
I tried to implement the query parameters for dialogs so map doc markdown files could also be searchable, but ran into issues. When searching through Content Pages or Maps with keywords, it is simple enough to route the user to that page without much hassle. Markdown files in a map, however, require much more handling.
Before I get into query parameter issues, here's how I was using them for clarity. To help ease parsing, there are 2 query parameters per dialog. They are in the form:
'dialog' + windowNumber
'dialog + windowNumber + 'Id'
so in a URL, the first opened dialog would look like:
https://localhost:4200/map/some-map-id?dialog1=map-layer-Text&dialog1Id=map-layer-id
Here is why they are not currently supported:
There were other issues to keep in mind, but they weren't as difficult to figure out. After writing out this documentation and talking to Steve, I realized I came up with a solution to most of the above issue, and at least might be able to implement the query params for map documentation files. No other dialog in the InfoMapper would be supported (except for the already supported opening of only one dialog with the same Id at a time), but at least the search could be improved because of this. I'll look into the code I've already done and see what I can do.
It would be nice to have advanced search features such as regular expressions, pipe for or, etc. This is a placeholder for future discussion of such features.