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?



asked 29 Oct '13, 01:33

alveniz's gravatar image

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

accept rate: 37%


Amigo muchas Gracias, Works...


(29 Oct '13, 17:09) alveniz
Your answer
toggle preview

Follow this question

By Email:

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



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:


question asked: 29 Oct '13, 01:33

question was seen: 31,706 times

last updated: 29 Oct '13, 17:09

powered by OSQA