A GeoJSON objects stores attributes inside an object called properties
.
It is important to include a condition limiting what should be indexed by this function.
Build an object that represents the key/value pairs that Solr will index. These will become the fields that you can search the Solr index on.
It is always important to include an ID value.
It is useful to include the identifier for the content model for NGDS purposes.
It is great if you can include a normative URL for this feature.
*_t fields will be indexed as text, and also added to the default full-text index field.
It is very important to index the geometry properly.
For points, this is as simple as listing the coordinates as x y
or lon lat
Here is more information about Geo and Solr
Finally, instruct CouchDB to "emit" the result.
It is important to give doc.cacheId
as the key. This will allow the results to be narrowed down to a single WFS if appropriate
An Example of a Map Function
This function generates a Solr index document from a GeoJSON representation of a ThermalSprings feature. Here we're presenting a relatively simple pattern that all such functions should follow: - Define the function as
module.exports = function (doc) {...}
. This will allow the program to find the function and include it in CouchDB. - The name of the file (striped of.js
) will become the name of the "view" in CouchDB. - This function is given one CouchDB document, and must return an object that represents the Solr index document for this feature. - Once included in the database, the view will be accessible at http://localhost:5984/usgin-features/design/usgin-features/view/yourFileName.