X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/db719d489fc7256ff26ce4b4bf7404e1429fff17..f0f6fcf256c83176dbcda0d0fd4fec977ea8a0ad:/nominatim/index.c diff --git a/nominatim/index.c b/nominatim/index.c index 2a5fa78b..90a3abea 100644 --- a/nominatim/index.c +++ b/nominatim/index.c @@ -140,13 +140,7 @@ struct index_thread_data * thread_data, const char *structuredoutputfile) // Get all the place_id's for this sector paramRank = PGint32(rank); - paramValues[0] = (char *)¶mRank; - paramLengths[0] = sizeof(paramRank); - paramFormats[0] = 1; paramSector = PGint32(sector); - paramValues[1] = (char *)¶mSector; - paramLengths[1] = sizeof(paramSector); - paramFormats[1] = 1; if (rankTotalTuples-rankCountTuples < num_threads*1000) { // no sectors @@ -156,6 +150,9 @@ struct index_thread_data * thread_data, const char *structuredoutputfile) } else { + paramValues[0] = (char *)¶mRank; + paramLengths[0] = sizeof(paramRank); + paramFormats[0] = 1; iResult = PQsendQueryPrepared(conn, "index_nosector_places", 1, paramValues, paramLengths, paramFormats, 1); } } @@ -163,11 +160,20 @@ struct index_thread_data * thread_data, const char *structuredoutputfile) { if (interpolation) { - iResult = PQsendQueryPrepared(conn, "index_sector_places", 2, paramValues, paramLengths, paramFormats, 1); + iResult = PQsendQueryPrepared(conn, "index_sector_places_osmline", 1, paramValues, paramLengths, paramFormats, 1); + paramValues[0] = (char *)¶mSector; + paramLengths[0] = sizeof(paramSector); + paramFormats[0] = 1; } else { - iResult = PQsendQueryPrepared(conn, "index_sector_places_osmline", 1, paramValues, paramLengths, paramFormats, 1); + paramValues[0] = (char *)¶mRank; + paramLengths[0] = sizeof(paramRank); + paramFormats[0] = 1; + paramValues[1] = (char *)¶mSector; + paramLengths[1] = sizeof(paramSector); + paramFormats[1] = 1; + iResult = PQsendQueryPrepared(conn, "index_sector_places", 2, paramValues, paramLengths, paramFormats, 1); } } if (!iResult) @@ -215,7 +221,15 @@ struct index_thread_data * thread_data, const char *structuredoutputfile) if (sleepcount++ > 500) { rankPerSecond = ((float)rankCountTuples + (float)count) / MAX(difftime(time(0), rankStartTime),1); - fprintf(stderr, " Done %i in %i @ %f per second - Rank %i ETA (seconds): %f\n", (rankCountTuples + count), (int)(difftime(time(0), rankStartTime)), rankPerSecond, rank, ((float)(rankTotalTuples - (rankCountTuples + count)))/rankPerSecond); + if(interpolation) + { + fprintf(stderr, " Done %i in %i @ %f per second - Interpolation lines ETA (seconds): %f\n", (rankCountTuples + count), (int)(difftime(time(0), rankStartTime)), rankPerSecond, ((float)(rankTotalTuples - (rankCountTuples + count)))/rankPerSecond); + } + else + { + fprintf(stderr, " Done %i in %i @ %f per second - Rank %i ETA (seconds): %f\n", (rankCountTuples + count), (int)(difftime(time(0), rankStartTime)), rankPerSecond, rank, ((float)(rankTotalTuples - (rankCountTuples + count)))/rankPerSecond); + } + sleepcount = 0; } } @@ -244,8 +258,6 @@ struct index_thread_data * thread_data, const char *structuredoutputfile) fprintf(stderr, "\r Done %i in %i @ %f per second - FINISHED\n\n", rankCountTuples, (int)(difftime(time(0), rankStartTime)), rankPerSecond); PQclear(resSectors); - - } void nominatim_index(int rank_min, int rank_max, int num_threads, const char *conninfo, const char *structuredoutputfile) @@ -404,17 +416,12 @@ void nominatim_index(int rank_min, int rank_max, int num_threads, const char *co } run_indexing(rank, 0, conn, num_threads, thread_data, structuredoutputfile); } - - - if (rank == 30) - { - // Close all connections - for (i = 0; i < num_threads; i++) - { - PQfinish(thread_data[i].conn); - } - PQfinish(conn); - } + // Close all connections + for (i = 0; i < num_threads; i++) + { + PQfinish(thread_data[i].conn); + } + PQfinish(conn); } void *nominatim_indexThread(void * thread_data_in)