Package de.komoot.photon.importer.model

Examples of de.komoot.photon.importer.model.PhotonDoc


    importThread.start();

    template.query("SELECT " + selectColsPlaceX + " FROM placex WHERE linked_place_id IS NULL order by geometry_sector; ", new RowCallbackHandler() {
      @Override
      public void processRow(ResultSet rs) throws SQLException {
        PhotonDoc doc = placeRowMapper.mapRow(rs, 0);

        if(!doc.isUsefulForIndex()) return; // do not import document
       
        // finalize document by taking into account the higher level address assigned to this doc.
        final List<AddressRow> addresses = getAddresses(doc);
        for(AddressRow address : addresses) {
          if(address.isCity()) {
            if(doc.getCity() != null) {
              doc.getContext().add(doc.getCity());
            }
            doc.setCity(address.getName());
          } else if(address.isStreet() && doc.getStreet() == null) {
            doc.setStreet(address.getName());
          } else if(address.hasPostcode() && doc.getPostcode() == null) {
            doc.setPostcode(address.getPostcode());
          } else {
            if(address.isUsefulForContext()) {
              doc.getContext().add(address.getName());
            }
          }
        }

View Full Code Here


   

    @Override
    public void run() {
      while (true) {
        PhotonDoc doc = null;
        try {
          doc = documents.take();
          if (doc == FINAL_DOCUMENT)
            break;
          importer.add(doc);
View Full Code Here

      LOGGER.info(String.format("Starting rank %d", rank));
      for(Map<String, Object> sector : getIndexSectors(rank))
        for(UpdateRow place : getIndexSectorPlaces(rank, (Integer) sector.get("geometry_sector"))) {

          template.update("update placex set indexed_status = 0 where place_id = ?", new Object[]{place.getPlaceId()});
          final PhotonDoc updatedDoc = exporter.getByPlaceId(place.getPlaceId());

          switch(place.getIndexdStatus()) {
            case 1:
              if(updatedDoc.isUsefulForIndex())
                updater.create(updatedDoc);
              break;
            case 2:
              if(!updatedDoc.isUsefulForIndex())
                updater.delete(place.getPlaceId());

              updater.updateOrCreate(updatedDoc);
              break;
            case 100:
View Full Code Here

  @Before
  public void setUp() {
    setUpES();
    deleteAll();
    PhotonDoc street1 = this.createStreetDoc(1, "Walserstraße", "6993");
    PhotonDoc street2 = this.createStreetDoc(2, "Walserstraße", "6993");
    PhotonDoc street3 = this.createStreetDoc(3, "Walserstraße", "6991");

    Importer instance = new Importer(getClient());
    instance.add(street1);
    instance.add(street2);
    instance.add(street3);
View Full Code Here

    instance.finish();
    refresh();
  }

  private PhotonDoc createStreetDoc(int id, String name, String postcode) {
    final PhotonDoc doc = new PhotonDoc(id, "way", id, "highway", "primary", ImmutableMap.of("name", name),
        null, null, null, 0, 0.5, null,
        FACTORY.createPoint(new Coordinate(10., 47.)),
        0, 0);
    doc.setPostcode(postcode);
    return doc;
  }
View Full Code Here

  @Test
  public void testAdd() {
    Map<String, String> nameMap = new HashMap<String, String>();
    nameMap.put("name", "testing");

    PhotonDoc doc = PhotonDoc.create(1, "way", 1, nameMap);
    Importer instance = new Importer(getClient());
    instance.add(doc);
    instance.finish();

    refresh();
View Full Code Here

TOP

Related Classes of de.komoot.photon.importer.model.PhotonDoc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.