List of usage examples for org.apache.lucene.document StoredField StoredField
public StoredField(String name, double value)
From source file:org.geotoolkit.lucene.LuceneSearcherTest.java
License:Open Source License
/** * Add a point geometry to the specified Document. * * @param doc The document to add the geometry * @param x The x coordinate of the point. * @param y The y coordinate of the point. * @param crsName The coordinate reference system in witch the coordinates are expressed. *//* ww w . j ava 2 s .c om*/ private static NamedEnvelope addPoint(final Document doc, final double x, final double y, final CoordinateReferenceSystem crs) throws Exception { Point pt = GF.createPoint(new Coordinate(x, y)); JTS.setCRS(pt, crs); final String id = doc.get("id"); NamedEnvelope namedBound = LuceneUtils.getNamedEnvelope(id, pt, treeCrs); doc.add(new StoredField(LuceneOGCFilter.GEOMETRY_FIELD_NAME, WKBUtils.toWKBwithSRID(pt))); return namedBound; }
From source file:org.geotoolkit.lucene.LuceneSearcherTest.java
License:Open Source License
/** * Add a boundingBox geometry to the specified Document. * * @param doc The document to add the geometry * @param minx the minimun X coordinate of the bounding box. * @param maxx the maximum X coordinate of the bounding box. * @param miny the minimun Y coordinate of the bounding box. * @param maxy the maximum Y coordinate of the bounding box. * @param crsName The coordinate reference system in witch the coordinates are expressed. */// w w w.j a v a 2s . c o m private static NamedEnvelope addBoundingBox(final Document doc, final double minx, final double maxx, final double miny, final double maxy, final CoordinateReferenceSystem crs) throws Exception { final Geometry poly = LuceneUtils.getPolygon(minx, maxx, miny, maxy, crs); final String id = doc.get("id"); NamedEnvelope namedBound = LuceneUtils.getNamedEnvelope(id, poly, treeCrs); doc.add(new StoredField(LuceneOGCFilter.GEOMETRY_FIELD_NAME, WKBUtils.toWKBwithSRID(poly))); return namedBound; }
From source file:org.geotoolkit.lucene.LuceneTest.java
License:Open Source License
/** * Add a Line geometry to the specified Document. * * @param doc The document to add the geometry * @param x1 the X coordinate of the first point of the line. * @param y1 the Y coordinate of the first point of the line. * @param x2 the X coordinate of the second point of the line. * @param y2 the Y coordinate of the first point of the line. * @param crsName The coordinate reference system in witch the coordinates are expressed. *//*from www .j a va2 s.c om*/ private static NamedEnvelope addLine(final Document doc, final double x1, final double y1, final double x2, final double y2, final CoordinateReferenceSystem crs) throws Exception { LineString line = GF.createLineString(new Coordinate[] { new Coordinate(x1, y1), new Coordinate(x2, y2) }); JTS.setCRS(line, crs); final String id = doc.get("id"); NamedEnvelope namedBound = LuceneUtils.getNamedEnvelope(id, line, CommonCRS.defaultGeographic()); doc.add(new StoredField(LuceneOGCFilter.GEOMETRY_FIELD_NAME, WKBUtils.toWKBwithSRID(line))); return namedBound; }
From source file:org.geotoolkit.lucene.LuceneTest.java
License:Open Source License
/** * Add a point geometry to the specified Document. * * @param doc The document to add the geometry * @param x The x coordinate of the point. * @param y The y coordinate of the point. * @param crsName The coordinate reference system in witch the coordinates are expressed. *//*from ww w . ja v a2 s . co m*/ private static NamedEnvelope addPoint(final Document doc, final double x, final double y, final CoordinateReferenceSystem crs) throws Exception { Point pt = GF.createPoint(new Coordinate(x, y)); JTS.setCRS(pt, crs); final String id = doc.get("id"); NamedEnvelope namedBound = LuceneUtils.getNamedEnvelope(id, pt, CommonCRS.defaultGeographic()); doc.add(new StoredField(LuceneOGCFilter.GEOMETRY_FIELD_NAME, WKBUtils.toWKBwithSRID(pt))); return namedBound; }
From source file:org.geotoolkit.lucene.LuceneTest.java
License:Open Source License
/** * Add a boundingBox geometry to the specified Document. * * @param doc The document to add the geometry * @param minx the minimun X coordinate of the bounding box. * @param maxx the maximum X coordinate of the bounding box. * @param miny the minimun Y coordinate of the bounding box. * @param maxy the maximum Y coordinate of the bounding box. * @param crsName The coordinate reference system in witch the coordinates are expressed. *//* w w w .j av a 2 s . c o m*/ private static NamedEnvelope addBoundingBox(final Document doc, final double minx, final double maxx, final double miny, final double maxy, final CoordinateReferenceSystem crs) throws Exception { final Geometry poly = LuceneUtils.getPolygon(minx, maxx, miny, maxy, crs); final String id = doc.get("id"); NamedEnvelope namedBound = LuceneUtils.getNamedEnvelope(id, poly, CommonCRS.defaultGeographic()); doc.add(new StoredField(LuceneOGCFilter.GEOMETRY_FIELD_NAME, WKBUtils.toWKBwithSRID(poly))); return namedBound; }
From source file:org.hibernate.search.backend.lucene.search.query.impl.ReusableDocumentStoredFieldVisitor.java
License:LGPL
@Override public void binaryField(FieldInfo fieldInfo, byte[] value) throws IOException { getDocument().add(new StoredField(fieldInfo.name, value)); }
From source file:org.hibernate.search.backend.lucene.search.query.impl.ReusableDocumentStoredFieldVisitor.java
License:LGPL
@Override public void intField(FieldInfo fieldInfo, int value) { getDocument().add(new StoredField(fieldInfo.name, value)); }
From source file:org.hibernate.search.backend.lucene.search.query.impl.ReusableDocumentStoredFieldVisitor.java
License:LGPL
@Override public void longField(FieldInfo fieldInfo, long value) { getDocument().add(new StoredField(fieldInfo.name, value)); }
From source file:org.hibernate.search.backend.lucene.search.query.impl.ReusableDocumentStoredFieldVisitor.java
License:LGPL
@Override public void floatField(FieldInfo fieldInfo, float value) { getDocument().add(new StoredField(fieldInfo.name, value)); }
From source file:org.hibernate.search.backend.lucene.search.query.impl.ReusableDocumentStoredFieldVisitor.java
License:LGPL
@Override public void doubleField(FieldInfo fieldInfo, double value) { getDocument().add(new StoredField(fieldInfo.name, value)); }