# Nominatim contribution guidelines
-## Workflow
+## Reporting Bugs
-We operate the "Fork & Pull" model explained at
+Bugs can be reported at https://github.com/openstreetmap/Nominatim/issues.
+Please always open a separate issue for each problem. In particular, do
+not add your bugs to closed issues. They may looks similar to you but
+often are completely different from the maintainer's point of view.
+
+### When Reporting Bad Search Results...
+
+Please make sure to add the following information:
+
+ * the URL of the query that produces the bad result
+ * the result you are getting
+ * the expected result, preferably a link to the OSM object you want to find,
+ otherwise an address that is as precise as possible
+
+ To get the link to the OSM object, you can try the following:
+
+ * go to https://openstreetmap.org
+ * zoom to the area of the map where you expect the result and
+ zoom in as much as possible
+ * click on the question mark on the right side of the map,
+ then with the queston cursor on the map where your object is located
+ * find the object of interest in the list that appears on the left side
+ * click on the object and report the URL back that the browser shows
+
+### When Reporting Problems with your Installation...
+
+Please add the following information to your issue:
+
+ * hardware configuration: RAM size, kind of disks
+ * Operating system (also mention if you are running on a cloud server)
+ * Postgres and Postgis version
+ * Nominatim version (commit id, if you run from the github repo)
+ * (if applicable) exact command line of the command that was causing the issues
+
+
+## Workflow for Pull Requests
+
+We love to get pull reuqests from you. We operate the "Fork & Pull" model
+explained at
https://help.github.com/articles/using-pull-requests
You should fork the project into your own repo, create a topic branch
there and then make one or more pull requests back to the openstreetmap repository.
-Your pull requests will then be reviewed and discussed.
+Your pull requests will then be reviewed and discussed. Please be aware
+that you are responsible for your pull requests. You should be prepared
+to get change requests because as the maintainers we have to make sure
+that your contribution fits well with the rest of the code. Please make
+sure that you have time to react to these comments and amend the code or
+engage in a conversion. Do not expect that others will pick up your code,
+it will almost never happen.
+
+Please open a separate pull request for each issue you want to address.
+Don't mix multiple changes. In particular, don't mix style cleanups with
+feature pull requests. If you plan to make larger changes, please open
+an issue first or comment on the appropriate issue already existing so
+that duplicate work can be avoided.
## Coding style
function javascript_renderData($xVal, $iOptions = 0)
{
- if (defined('PHP_VERSION_ID') && PHP_VERSION_ID > 50400)
- $iOptions |= JSON_UNESCAPED_UNICODE;
+ $iOptions |= JSON_UNESCAPED_UNICODE;
+ if (isset($_GET['pretty']) && in_array(strtolower($_GET['pretty']), array('1', 'true'))) {
+ $iOptions |= JSON_PRETTY_PRINT;
+ }
+
$jsonout = json_encode($xVal, $iOptions);
- if (! isset($_GET['json_callback'])) {
+ if (!isset($_GET['json_callback'])) {
header("Content-Type: application/json; charset=UTF-8");
echo $jsonout;
} else {
nameaddress_vector INTEGER[];
linked_node_id BIGINT;
+ linked_importance FLOAT;
+ linked_wikipedia TEXT;
result BOOLEAN;
BEGIN
-- keep a note of the node id in case we need it for wikipedia in a bit
linked_node_id := linkedPlacex.osm_id;
+ select language||':'||title,importance from get_wikipedia_match(linkedPlacex.extratags, NEW.country_code) INTO linked_wikipedia,linked_importance;
END LOOP;
END LOOP;
-- keep a note of the node id in case we need it for wikipedia in a bit
linked_node_id := linkedPlacex.osm_id;
+ select language||':'||title,importance from get_wikipedia_match(linkedPlacex.extratags, NEW.country_code) INTO linked_wikipedia,linked_importance;
END IF;
END LOOP;
-- keep a note of the node id in case we need it for wikipedia in a bit
linked_node_id := linkedPlacex.osm_id;
+ select language||':'||title,importance from get_wikipedia_match(linkedPlacex.extratags, NEW.country_code) INTO linked_wikipedia,linked_importance;
END LOOP;
END IF;
END IF;
END IF;
- -- Did we gain a wikipedia tag in the process? then we need to recalculate our importance
- IF NEW.importance is null THEN
- select language||':'||title,importance from get_wikipedia_match(NEW.extratags, NEW.country_code) INTO NEW.wikipedia,NEW.importance;
+ -- Use the maximum importance if a one could be computed from the linked object.
+ IF linked_importance is not null AND
+ (NEW.importance is null or NEW.importance < linked_importance) THEN
+ NEW.importance = linked_importance;
END IF;
+
-- Still null? how about looking it up by the node id
IF NEW.importance IS NULL THEN
select language||':'||title,importance from wikipedia_article where osm_type = 'N'::char(1) and osm_id = linked_node_id order by importance desc limit 1 INTO NEW.wikipedia,NEW.importance;