Package com.day.cq.search.writer
Class SimpleHitWriter
- java.lang.Object
-
- com.day.cq.search.writer.SimpleHitWriter
-
- All Implemented Interfaces:
ResultHitWriter
public class SimpleHitWriter extends java.lang.Object implements ResultHitWriter
SimpleHitWriter writes common properties that are available on most JCR nodes, eg. path, excerpt, name, title, lastModified, created, size and mimeType.
-
-
Constructor Summary
Constructors Constructor Description SimpleHitWriter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
write(Hit hit, JSONWriter writer, Query query)
Writes a givenHit
into theJSONWriter
.static void
writeSimpleJson(Hit hit, JSONWriter writer)
-
-
-
Field Detail
-
KILO_BYTE
public static final long KILO_BYTE
- See Also:
- Constant Field Values
-
MEGA_BYTE
public static final long MEGA_BYTE
- See Also:
- Constant Field Values
-
GIGA_BYTE
public static final long GIGA_BYTE
- See Also:
- Constant Field Values
-
TERA_BYTE
public static final long TERA_BYTE
- See Also:
- Constant Field Values
-
PETA_BYTE
public static final long PETA_BYTE
- See Also:
- Constant Field Values
-
-
Method Detail
-
write
public void write(Hit hit, JSONWriter writer, Query query) throws RepositoryException, JSONException
Description copied from interface:ResultHitWriter
Writes a givenHit
into theJSONWriter
. This will be called for each hit of the result page. The surrounding json structure is an array and each entry should be a simple object. The caller will have invoked thewriter.object()
already and will callwriter.endObject()
directly after this method returns.- Specified by:
write
in interfaceResultHitWriter
- Parameters:
hit
- the result hit to renderwriter
- to output jsonquery
- the original query; can be used to access custom parameters set in the predicate root group (query.getPredicates().get("param", "default")
)- Throws:
RepositoryException
- in case access on the hit failedJSONException
- in case there is a problem with writing to the jsonwriter
-
writeSimpleJson
public static void writeSimpleJson(Hit hit, JSONWriter writer) throws RepositoryException, JSONException
- Throws:
RepositoryException
JSONException
-
-