NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

Hi all

I installed nominatim in a server..., in this route: /module/tokenstringreplacements.inc, I index a new abbreviations, a sample:

str_replace(buffer, &len, &changes, " diagonal ", 10, " diag ", 6, 0); str_replace(buffer, &len, &changes, " diagonal ", 10, " dg ", 6, 0); str_replace(buffer, &len, &changes, " diagonal ", 10, " dig ", 6, 0);

I search by diagonal and diag in results OK, but a search a new created abbreviations "dg" and "dig" and NOT search...

is a /tokenstringreplacements.inc the data of abbreviations in search, or any other archive editet for the index abbreviations?

thanks

Alveniz

asked 29 Oct '13, 01:33

alveniz's gravatar image

alveniz
51557
accept rate: 0%


tokenstringreplacements.inc is the right place for abbreviations but it is working in the opposite than what you seem to expect. What it does is to replace all unabbreviated terms with their short version. This way, only abbreviated versions of the names are saved in the database and equally the search terms are abbreviated before matching.

If in your case you want to be able to find "foo diagonal" also by typing "foo diag", "foo dig", and "foo dg", then all four terms have to be replaced with the same thing, so that they match. You should use the most ambiguous abbreviation as the common term, in this case "dg". So the replacements should be:

str_replace(buffer, &len, &changes, " diagonal ", 10, " dg ", 4, 0); 
str_replace(buffer, &len, &changes, " diag ", 6, " dg ", 4, 0);
str_replace(buffer, &len, &changes, " dig ", 5, " dg ", 4, 0);

Note that these changes have to be done before the import, as the normalization needs to be applied to the names in the imported OSM data as well.

permanent link

answered 29 Oct '13, 07:57

lonvia's gravatar image

lonvia
6.2k25789
accept rate: 40%

2

Amigo muchas Gracias, Works...

Alveniz

(29 Oct '13, 17:09) alveniz

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×689
×219
×4

question asked: 29 Oct '13, 01:33

question was seen: 34,051 times

last updated: 29 Oct '13, 17:09

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum