Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync search #657

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions include/OsmAndCore/Data/ObfPoiSectionReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <OsmAndCore.h>
#include <OsmAndCore/CommonTypes.h>
#include <OsmAndCore/Data/DataCommonTypes.h>
#include "binaryRead.h"

namespace OsmAnd
{
Expand All @@ -19,6 +20,7 @@ namespace OsmAnd
class ObfPoiSectionInfo;
class Amenity;
class IQueryController;
class MapDataObject;

class OSMAND_CORE_API ObfPoiSectionReader
{
Expand Down Expand Up @@ -51,9 +53,10 @@ namespace OsmAnd
const ZoomLevel zoomFilter = InvalidZoomLevel,
const QSet<ObfPoiCategoryId>* const categoriesFilter = nullptr,
const ObfPoiSectionReader::VisitorFunction visitor = nullptr,
const std::shared_ptr<const IQueryController>& queryController = nullptr);
const std::shared_ptr<const IQueryController>& queryController = nullptr,
const std::shared_ptr<SearchRequest<MapDataObject>>& req = nullptr);

static void scanAmenitiesByName(
static void searchAmenitiyByName(
const std::shared_ptr<const ObfReader>& reader,
const std::shared_ptr<const ObfPoiSectionInfo>& section,
const QString& query,
Expand All @@ -63,7 +66,8 @@ namespace OsmAnd
const TileAcceptorFunction tileFilter = nullptr,
const QSet<ObfPoiCategoryId>* const categoriesFilter = nullptr,
const ObfPoiSectionReader::VisitorFunction visitor = nullptr,
const std::shared_ptr<const IQueryController>& queryController = nullptr);
const std::shared_ptr<const IQueryController>& queryController = nullptr,
const std::shared_ptr<SearchRequest<MapDataObject>>& req = nullptr);
};
}

Expand Down
2 changes: 1 addition & 1 deletion include/OsmAndCore/ObfDataInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace OsmAnd
const ObfPoiSectionReader::VisitorFunction visitor = nullptr,
const std::shared_ptr<const IQueryController>& queryController = nullptr);

bool scanAmenitiesByName(
bool searchAmenitiesByName(
const QString& query,
QList< std::shared_ptr<const OsmAnd::Amenity> >* outAmenities,
const PointI* const xy31 = nullptr,
Expand Down
6 changes: 5 additions & 1 deletion src/Data/ObfAddressSectionReader_P.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,8 +1084,12 @@ void OsmAnd::ObfAddressSectionReader_P::scanNameIndex(
const auto length = ObfReaderUtilities::readBigEndianInt(cis);
baseOffset = cis->CurrentPosition();
const auto oldLimit = cis->PushLimit(length);

QVector<int> charsList = {0};
QList<QString> queries = {query};
QList<QVector<uint32_t>> lofsets = {intermediateOffsets};

ObfReaderUtilities::scanIndexedStringTable(cis, query, intermediateOffsets, strictMatch);
ObfReaderUtilities::readIndexedStringTable(cis, queries, lofsets, charsList);
ObfReaderUtilities::ensureAllDataWasRead(cis);

cis->PopLimit(oldLimit);
Expand Down
16 changes: 10 additions & 6 deletions src/Data/ObfPoiSectionReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ void OsmAnd::ObfPoiSectionReader::loadAmenities(
const ZoomLevel zoomFilter /*= InvalidZoomLevel*/,
const QSet<ObfPoiCategoryId>* const categoriesFilter /*= nullptr*/,
const ObfPoiSectionReader::VisitorFunction visitor /*= nullptr*/,
const std::shared_ptr<const IQueryController>& queryController /*= nullptr*/)
const std::shared_ptr<const IQueryController>& queryController /*= nullptr*/,
const std::shared_ptr<SearchRequest<MapDataObject>>& req /*= nullptr*/)
{
ObfPoiSectionReader_P::loadAmenities(
*reader->_p,
Expand All @@ -49,10 +50,11 @@ void OsmAnd::ObfPoiSectionReader::loadAmenities(
zoomFilter,
categoriesFilter,
visitor,
queryController);
queryController,
req);
}

void OsmAnd::ObfPoiSectionReader::scanAmenitiesByName(
void OsmAnd::ObfPoiSectionReader::searchAmenitiyByName(
const std::shared_ptr<const ObfReader>& reader,
const std::shared_ptr<const ObfPoiSectionInfo>& section,
const QString& query, QList< std::shared_ptr<const OsmAnd::Amenity> >* outAmenities,
Expand All @@ -61,9 +63,10 @@ void OsmAnd::ObfPoiSectionReader::scanAmenitiesByName(
const TileAcceptorFunction tileFilter /*= nullptr*/,
const QSet<ObfPoiCategoryId>* const categoriesFilter /*= nullptr*/,
const ObfPoiSectionReader::VisitorFunction visitor /*= nullptr*/,
const std::shared_ptr<const IQueryController>& queryController /*= nullptr*/)
const std::shared_ptr<const IQueryController>& queryController /*= nullptr*/,
const std::shared_ptr<SearchRequest<MapDataObject>>& req /*= nullptr*/)
{
ObfPoiSectionReader_P::scanAmenitiesByName(
ObfPoiSectionReader_P::searchAmenitiyByName(
*reader->_p,
section,
query,
Expand All @@ -73,5 +76,6 @@ void OsmAnd::ObfPoiSectionReader::scanAmenitiesByName(
tileFilter,
categoriesFilter,
visitor,
queryController);
queryController,
req);
}
Loading