title: Difference Between Local Nominatim and OpenStreetMap Website While Geocoding
body: <p>I have installed nominatim via following instructions on <a href="https://nominatim.org/release-docs/latest/admin/Installation/" rel="nofollow noreferrer">nominatim documentation</a> and it's really great project. My local instance is running on docker via using <a href="https://github.com/mediagis/nominatim-docker" rel="nofollow noreferrer">this github repository</a> as suggested on documentation.</p>
  <p>I have almost 13k address data and need to geocode those addresses, my first attempt on using local instance got almost ~6k successful geocode result.</p>
  <p>When I sent some of unsuccessful results to <a href="https://nominatim.openstreetmap.org/" rel="nofollow noreferrer">Nominatim Website</a> I got the results that local instance did not respond successfully.</p>
  <p>Consider following example which is an address in Slovakia,
  <code>Ruzová 173/35 Borsa 7632 SK</code></p>
  <p>Nominatim Website returns successful result for this query but my local instance do not.</p>
  <p><strong>Attempt #1</strong> I checked the detail pages and found that local instance's Software Version is <code>4.0.1</code> whereas website's version is <code>4.0.99-4</code>.</p>
  <p>So I build the source code from master branch of the <a href="https://github.com/osm-search/Nominatim" rel="nofollow noreferrer">nominatim repository</a>. And now my local instance is <code>4.0.99-5</code>. Unfortunately this also did not solve my issue but I continue to use <code>4.0.99-5</code> on following attempts.</p>
  <p><strong>Attempt #2</strong> I added wikipedia data while building the local instance, thought that it would be helpful but it didn't.</p>
  <p><strong>Attempt #3</strong> I changed the locale of the container to <code>sk_SK.UTF-8</code> I thought it might be a language issue, no way it didn't work.</p>
  <p><em>What I discover is</em>, when I fix the postal code with 0 prefix; in this case converting <code>7632</code> to <code>07632</code> problem is solved, in some cases when I completely delete postal code it works fine or when I seperate it like <code>85 107</code> it also works but I really don't know why. This trick is really improved my coverage. Almost 9k addresses are geocoded(~3k improvement).</p>
  <p>I hope it is clear for you and even small advice or comment would be very helpful for me. Here is my possible road maps and future attempts that I can choose:</p>
  <p><strong><em>Possible</em> Attempt #4</strong></p>
  <ul>
  <li>Should I change my tokenizer? Does Nominatim Website use <code>NOMINATIM_TOKENIZER=icu</code> or <code>NOMINATIM_TOKENIZER=legacy</code>?  Right now I'm using <code>legacy</code> and maybe <code>Attempt #4</code> should be changing it to <code>icu</code>, because when I dive into debug mode I see following output:</li>
  </ul>
  <p><strong>Nominatim Site</strong></p>
  <pre><code>Tokenization
  Phrase:  'ruzova 173 35 borsa 7632 sk'
  Tokens:  'ruzova' =&gt; 'ruzova'
           'ruzova 173' =&gt; 'ruzova 173'
           'ruzova 173 35' =&gt; 'ruzova 173 35'
           'ruzova 173 35 borsa' =&gt; 'ruzova 173 35 borsa'
           'ruzova 173 35 borsa 7632' =&gt; 'ruzova 173 35 borsa 7632'
           'ruzova 173 35 borsa 7632 sk' =&gt; 'ruzova 173 35 borsa 7632 sk'
           0 =&gt; '173'
           '173 35' =&gt; '173 35'
           '173 35 borsa' =&gt; '173 35 borsa'
           '173 35 borsa 7632' =&gt; '173 35 borsa 7632'
           '173 35 borsa 7632 sk' =&gt; '173 35 borsa 7632 sk'
           1 =&gt; '35'
           '35 borsa' =&gt; '35 borsa'
           '35 borsa 7632' =&gt; '35 borsa 7632'
           '35 borsa 7632 sk' =&gt; '35 borsa 7632 sk'
           'borsa' =&gt; 'borsa'
           'borsa 7632' =&gt; 'borsa 7632'
           'borsa 7632 sk' =&gt; 'borsa 7632 sk'
           2 =&gt; '7632'
           '7632 sk' =&gt; '7632 sk'
           'sk' =&gt; 'sk'
  WordLists:  0 =&gt; 0 =&gt; 'ruzova'
                   1 =&gt; '173'
                   2 =&gt; '35'
                   3 =&gt; 'borsa'
                   4 =&gt; '7632'
                   5 =&gt; 'sk'
  SELECT word_id, word_token, type, word, info-&gt;&gt;'op' as operator, info-&gt;&gt;'class' as class, info-&gt;&gt;'type' as ctype, info-&gt;&gt;'count' as count FROM word WHERE word_token in ('ruzova','ruzova 173','ruzova 173 35','ruzova 173 35 borsa','ruzova 173 35 borsa 7632','ruzova 173 35 borsa 7632 sk','173','173 35','173 35 borsa','173 35 borsa 7632','173 35 borsa 7632 sk','35','35 borsa','35 borsa 7632','35 borsa 7632 sk','borsa','borsa 7632','borsa 7632 sk','7632','7632 sk','sk')
  </code></pre>
  <p><strong>Local</strong></p>
  <pre><code>Tokenization
  SELECT make_standard_name(:0) as p0
  
  SQL parameters:  ':0' =&gt; 'Ruzová 173/35 Borsa 7632 SK'
  SQL result:  'p0' =&gt; 'ruzova 173 35 borsa 7632 sk'
  Tokens:  ' ruzova' =&gt; ' ruzova'
           'ruzova' =&gt; 'ruzova'
           ' ruzova 173' =&gt; ' ruzova 173'
           'ruzova 173' =&gt; 'ruzova 173'
           ' ruzova 173 35' =&gt; ' ruzova 173 35'
           'ruzova 173 35' =&gt; 'ruzova 173 35'
           ' ruzova 173 35 borsa' =&gt; ' ruzova 173 35 borsa'
           'ruzova 173 35 borsa' =&gt; 'ruzova 173 35 borsa'
           ' ruzova 173 35 borsa 7632' =&gt; ' ruzova 173 35 borsa 7632'
           'ruzova 173 35 borsa 7632' =&gt; 'ruzova 173 35 borsa 7632'
           ' ruzova 173 35 borsa 7632 sk' =&gt; ' ruzova 173 35 borsa 7632 sk'
           'ruzova 173 35 borsa 7632 sk' =&gt; 'ruzova 173 35 borsa 7632 sk'
           ' 173' =&gt; ' 173'
           173 =&gt; '173'
           ' 173 35' =&gt; ' 173 35'
           '173 35' =&gt; '173 35'
           ' 173 35 borsa' =&gt; ' 173 35 borsa'
           '173 35 borsa' =&gt; '173 35 borsa'
           ' 173 35 borsa 7632' =&gt; ' 173 35 borsa 7632'
           '173 35 borsa 7632' =&gt; '173 35 borsa 7632'
           ' 173 35 borsa 7632 sk' =&gt; ' 173 35 borsa 7632 sk'
           '173 35 borsa 7632 sk' =&gt; '173 35 borsa 7632 sk'
           ' 35' =&gt; ' 35'
           35 =&gt; '35'
           ' 35 borsa' =&gt; ' 35 borsa'
           '35 borsa' =&gt; '35 borsa'
           ' 35 borsa 7632' =&gt; ' 35 borsa 7632'
           '35 borsa 7632' =&gt; '35 borsa 7632'
           ' 35 borsa 7632 sk' =&gt; ' 35 borsa 7632 sk'
           '35 borsa 7632 sk' =&gt; '35 borsa 7632 sk'
           ' borsa' =&gt; ' borsa'
           'borsa' =&gt; 'borsa'
           ' borsa 7632' =&gt; ' borsa 7632'
           'borsa 7632' =&gt; 'borsa 7632'
           ' borsa 7632 sk' =&gt; ' borsa 7632 sk'
           'borsa 7632 sk' =&gt; 'borsa 7632 sk'
           ' 7632' =&gt; ' 7632'
           7632 =&gt; '7632'
           ' 7632 sk' =&gt; ' 7632 sk'
           '7632 sk' =&gt; '7632 sk'
           ' sk' =&gt; ' sk'
           'sk' =&gt; 'sk'
  WordLists:  0 =&gt; 0 =&gt; 'ruzova'
                   1 =&gt; '173'
                   2 =&gt; '35'
                   3 =&gt; 'borsa'
                   4 =&gt; '7632'
                   5 =&gt; 'sk'
  SELECT word_id, word_token, word, class, type, country_code, operator, coalesce(search_name_count, 0) as count FROM word WHERE word_token in (' ruzova','ruzova',' ruzova 173','ruzova 173',' ruzova 173 35','ruzova 173 35',' ruzova 173 35 borsa','ruzova 173 35 borsa',' ruzova 173 35 borsa 7632','ruzova 173 35 borsa 7632',' ruzova 173 35 borsa 7632 sk','ruzova 173 35 borsa 7632 sk',' 173','173',' 173 35','173 35',' 173 35 borsa','173 35 borsa',' 173 35 borsa 7632','173 35 borsa 7632',' 173 35 borsa 7632 sk','173 35 borsa 7632 sk',' 35','35',' 35 borsa','35 borsa',' 35 borsa 7632','35 borsa 7632',' 35 borsa 7632 sk','35 borsa 7632 sk',' borsa','borsa',' borsa 7632','borsa 7632',' borsa 7632 sk','borsa 7632 sk',' 7632','7632',' 7632 sk','7632 sk',' sk','sk')
  </code></pre>
  <p><strong><em>Possible</em> Attempt #5</strong></p>
  <ul>
  <li>Should I change my PostgreSQL instance? Currently using: <code>starting PostgreSQL 12.9 (Ubuntu 12.9-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, 64-bit</code></li>
  </ul>
  <p>Your feedback really matters to me and all supports are accepted, thank you!</p>