예제 #1
0
  public static GeoSearchConfig getGeoSearchConfig() {
    GeoSearchConfig geoConfig = new GeoSearchConfig();

    geoConfig.addFieldBitMask(LOCATION_FIELD, (byte) 1);

    return geoConfig;
  }
예제 #2
0
  void buildGeoIndexWriter() throws CorruptIndexException, LockObtainFailedException, IOException {
    geoComparator = new CartesianGeoRecordComparator();
    geoRecordSerializer = new CartesianGeoRecordSerializer();

    directory = new RAMDirectory();

    config =
        new IndexWriterConfig(Version.LUCENE_CURRENT, new StandardAnalyzer(Version.LUCENE_CURRENT));

    config.setMergePolicy(new MergeOnOptimizeOnly());

    geoConfig = getGeoSearchConfig();
    geoConfig.addFieldBitMask(LOCATION_FIELD, LOCATION_BIT_MASK);
    geoConfig.addFieldBitMask(IMAGE_LOCATION_FIELD, IMAGE_LOCATION_BIT_MASK);

    writer = new GeoIndexWriter(directory, config, geoConfig);
  }