在ArangoDB中实现您自己的哈希算法

时间:2018-12-26 10:43:31

标签: spring-data arangodb

如果其中一个值重复,则写入双[](地理索引)数据会产生异常。

将KML文件(Google地图)导入ArangoDb

  • arangodb-spring-boot-starter = 1.0.1
  • arangodb-spring-data = 3.2.1
  public District saveAsNew(District district) {
    final District savedDistrict = dr.save(district);
    district.locations().forEach(location -> {
        log.debug("Saving location {} for {}", location, district.name());
        final Location savedLocation = lr.save(location);
        dlr.save(new LocationOf().district(savedDistrict).location(savedLocation));
    });
    return savedDistrict;
}
2018-12-26 11:39:36.846 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9104016, 17.408695]) for Jaz w Lipki
2018-12-26 11:39:36.847 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9112675, 17.4056051]) for Jaz w Lipki
2018-12-26 11:39:36.849 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9143521, 17.4028585]) for Jaz w Lipki
2018-12-26 11:39:36.850 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9188975, 17.402601]) for Jaz w Lipki
2018-12-26 11:39:36.851 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9203043, 17.4002836]) for Jaz w Lipki
2018-12-26 11:39:36.852 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9210618, 17.3966787]) for Jaz w Lipki
2018-12-26 11:39:36.853 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9220358, 17.3896406]) for Jaz w Lipki
2018-12-26 11:39:36.854 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9239294, 17.3832891]) for Jaz w Lipki
2018-12-26 11:39:36.855 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9254443, 17.3788259]) for Jaz w Lipki
2018-12-26 11:39:36.856 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9254984, 17.3710153]) for Jaz w Lipki
2018-12-26 11:39:36.857 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9257689, 17.3685262]) for Jaz w Lipki
2018-12-26 11:39:36.859 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9284739, 17.3632047]) for Jaz w Lipki
2018-12-26 11:39:36.860 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9303673, 17.3558233]) for Jaz w Lipki
2018-12-26 11:39:36.861 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9313951, 17.3455236]) for Jaz w Lipki
2018-12-26 11:39:36.862 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9339375, 17.3389146]) for Jaz w Lipki
2018-12-26 11:39:36.863 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9393464, 17.3383996]) for Jaz w Lipki
2018-12-26 11:39:36.864 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9415638, 17.337198]) for Jaz w Lipki
2018-12-26 11:39:36.865 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9431863, 17.3367688]) for Jaz w Lipki
2018-12-26 11:39:36.867 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9448628, 17.3347947]) for Jaz w Lipki
2018-12-26 11:39:36.868 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9447546, 17.3305032]) for Jaz w Lipki
2018-12-26 11:39:36.869 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9439975, 17.3269842]) for Jaz w Lipki
2018-12-26 11:39:36.870 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9437812, 17.3235509]) for Jaz w Lipki
2018-12-26 11:39:36.871 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9453495, 17.3171995]) for Jaz w Lipki
2018-12-26 11:39:36.872 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9443761, 17.3115346]) for Jaz w Lipki
2018-12-26 11:39:36.874 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.945025, 17.3080156]) for Jaz w Lipki
2018-12-26 11:39:36.877 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9462017, **17.3070084**]) for Jaz w Lipki
2018-12-26 11:39:36.879 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9481958, 17.3063861]) for Jaz w Lipki
2018-12-26 11:39:36.880 DEBUG 21762 --- [           main] p.s.p.service.DistanceService            : Saving location Location(id=null, location=[50.9530285, **17.3070084**]) for Jaz w Lipki

org.springframework.dao.DataIntegrityViolationException: Response: 409, Error: 1210 - unique constraint violated - in index 3063030 of type hash over ["location[*]"]; conflicting key: 3133664; nested exception is com.arangodb.ArangoDBException: Response: 409, Error: 1210 - unique constraint violated - in index 3063030 of type hash over ["location[*]"]; conflicting key: 3133664

哈希生成器的数量已超过。

1 个答案:

答案 0 :(得分:1)

问题解决了。因为我将域名与很多东西结合在一起。

我保存了许多冲突的配置“ HashIndex”。

从我们不感兴趣的管理员面板中手动删除密钥或删除整个集合的解决方案。