public class DocumentQueryCustomization extends Object implements IDocumentQueryCustomization
Constructor and Description |
---|
DocumentQueryCustomization(DocumentQuery<?> delegate) |
Modifier and Type | Method and Description |
---|---|
IDocumentQueryCustomization |
beforeQueryExecution(Action1<IndexQuery> action)
Allow you to modify the index query before it is executed
|
IDocumentQueryCustomization |
customSortUsing(String typeName)
Sort using custom sorter on the server
|
IDocumentQueryCustomization |
customSortUsing(String typeName,
boolean descending)
Sort using custom sorter on the server
|
IDocumentQueryCustomization |
highlight(String fieldName,
int fragmentLength,
int fragmentCount,
Reference<FieldHighlightings> highlightings)
Adds matches highlighting for the specified field.
|
IDocumentQueryCustomization |
highlight(String fieldName,
int fragmentLength,
int fragmentCount,
String fragmentsField)
Adds matches highlighting for the specified field.
|
IDocumentQueryCustomization |
highlight(String fieldName,
String fieldKeyName,
int fragmentLength,
int fragmentCount,
Reference<FieldHighlightings> highlightings)
Adds matches highlighting for the specified field.
|
IDocumentQueryCustomization |
include(Class<?> targetClass,
com.mysema.query.types.Path<?> path)
Includes the specified path in the query, loading the document specified in that path
|
IDocumentQueryCustomization |
include(com.mysema.query.types.Path<?> path)
Includes the specified path in the query, loading the document specified in that path
|
IDocumentQueryCustomization |
include(String path)
Includes the specified path in the query, loading the document specified in that path
|
IDocumentQueryCustomization |
noCaching()
Disables caching for query results.
|
IDocumentQueryCustomization |
noTracking()
Disables tracking for queried entities by Raven's Unit of Work.
|
IDocumentQueryCustomization |
randomOrdering()
Order the search results randomly
|
IDocumentQueryCustomization |
randomOrdering(String seed)
Order the search results randomly using the specified seed
this is useful if you want to have repeatable random queries
|
IDocumentQueryCustomization |
relatesToShape(String fieldName,
String shapeWKT,
SpatialOptions.SpatialRelation rel)
Filter matches based on a given shape - only documents with the shape defined in fieldName that
have a relation rel with the given shapeWKT will be returned
|
IDocumentQueryCustomization |
setAllowMultipleIndexEntriesForSameDocumentToResultTransformer(boolean value)
If set to true, this property will send multiple index entries from the same document (assuming the index project them)
to the result transformer function.
|
IDocumentQueryCustomization |
setHighlighterTags(String[] preTags,
String[] postTags)
Sets the tags to highlight matches with.
|
IDocumentQueryCustomization |
setHighlighterTags(String preTag,
String postTag)
Sets the tags to highlight matches with.
|
IDocumentQueryCustomization |
showTimings()
Enables calculation of timings for various parts of a query (Lucene search, loading documents, transforming results).
|
IDocumentQueryCustomization |
sortByDistance()
When using spatial queries, instruct the query to sort by the distance from the origin point
|
IDocumentQueryCustomization |
sortByDistance(double lat,
double lng)
When using spatial queries, instruct the query to sort by the distance from the origin point
|
IDocumentQueryCustomization |
sortByDistance(double lat,
double lng,
String sortedFieldName)
When using spatial queries, instruct the query to sort by the distance from the origin point
|
IDocumentQueryCustomization |
spatial(String fieldName,
SpatialCriteria criteria)
Ability to use one factory to determine spatial shape that will be used in query.
|
String |
toString() |
IDocumentQueryCustomization |
transformResults(ShardReduceFunction func) |
IDocumentQueryCustomization |
waitForNonStaleResults()
EXPERT ONLY: Instructs the query to wait for non stale results.
|
IDocumentQueryCustomization |
waitForNonStaleResults(long waitTimeout)
EXPERT ONLY: Instructs the query to wait for non stale results for the specified wait timeout.
|
IDocumentQueryCustomization |
waitForNonStaleResultsAsOf(Date cutOff)
Instructs the query to wait for non stale results as of the cutoff date.
|
IDocumentQueryCustomization |
waitForNonStaleResultsAsOf(Date cutOff,
long waitTimeout)
Instructs the query to wait for non stale results as of the cutoff date for the specified timeout
|
IDocumentQueryCustomization |
waitForNonStaleResultsAsOf(Etag cutOffEtag)
Instructs the query to wait for non stale results as of the cutoff etag.
|
IDocumentQueryCustomization |
waitForNonStaleResultsAsOf(Etag cutOffEtag,
long waitTimeout)
Instructs the query to wait for non stale results as of the cutoff etag for the specified timeout.
|
IDocumentQueryCustomization |
waitForNonStaleResultsAsOfLastWrite()
Instructs the query to wait for non stale results as of the last write made by any session belonging to the
current document store.
|
IDocumentQueryCustomization |
waitForNonStaleResultsAsOfLastWrite(long waitTimeout)
Instructs the query to wait for non stale results as of the last write made by any session belonging to the
current document store.
|
IDocumentQueryCustomization |
waitForNonStaleResultsAsOfNow()
Instructs the query to wait for non stale results as of now.
|
IDocumentQueryCustomization |
waitForNonStaleResultsAsOfNow(long waitTimeout)
Instructs the query to wait for non stale results as of now for the specified timeout.
|
IDocumentQueryCustomization |
withinRadiusOf(double radius,
double latitude,
double longitude)
Filter matches to be inside the specified radius.
|
IDocumentQueryCustomization |
withinRadiusOf(double radius,
double latitude,
double longitude,
SpatialOptions.SpatialUnits radiusUnits)
Filter matches to be inside the specified radius
|
IDocumentQueryCustomization |
withinRadiusOf(String fieldName,
double radius,
double latitude,
double longitude)
Filter matches to be inside the specified radius
|
IDocumentQueryCustomization |
withinRadiusOf(String fieldName,
double radius,
double latitude,
double longitude,
SpatialOptions.SpatialUnits radiusUnits)
Filter matches to be inside the specified radius
|
public DocumentQueryCustomization(DocumentQuery<?> delegate)
public IDocumentQueryCustomization waitForNonStaleResultsAsOfLastWrite()
IDocumentQueryCustomization
waitForNonStaleResultsAsOfLastWrite
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization waitForNonStaleResultsAsOfLastWrite(long waitTimeout)
IDocumentQueryCustomization
waitForNonStaleResultsAsOfLastWrite
in interface IDocumentQueryCustomization
waitTimeout
- Maximum time to wait for index query results to become non-stale before exception is thrown.public IDocumentQueryCustomization transformResults(ShardReduceFunction func)
transformResults
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization waitForNonStaleResultsAsOfNow()
IDocumentQueryCustomization
waitForNonStaleResultsAsOfNow
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization waitForNonStaleResultsAsOfNow(long waitTimeout)
IDocumentQueryCustomization
waitForNonStaleResultsAsOfNow
in interface IDocumentQueryCustomization
waitTimeout
- Maximum time to wait for index query results to become non-stale before exception is thrown.public IDocumentQueryCustomization waitForNonStaleResultsAsOf(Date cutOff)
IDocumentQueryCustomization
waitForNonStaleResultsAsOf
in interface IDocumentQueryCustomization
cutOff
- Index will be considered stale if modification date of last indexed document is greater than this value.public IDocumentQueryCustomization waitForNonStaleResultsAsOf(Date cutOff, long waitTimeout)
IDocumentQueryCustomization
waitForNonStaleResultsAsOf
in interface IDocumentQueryCustomization
cutOff
- Index will be considered stale if modification date of last indexed document is greater than this value.waitTimeout
- Maximum time to wait for index query results to become non-stale before exception is thrown.public IDocumentQueryCustomization waitForNonStaleResultsAsOf(Etag cutOffEtag)
IDocumentQueryCustomization
waitForNonStaleResultsAsOf
in interface IDocumentQueryCustomization
cutOffEtag
- Cutoff etag is used to check if the index has already process a document with the given
etag. Unlike Cutoff, which uses dates and is susceptible to clock synchronization issues between
machines, cutoff etag doesn't rely on both the server and client having a synchronized clock and
can work without it.
However, when used to query map/reduce indexes, it does NOT guarantee that the document that this
etag belong to is actually considered for the results.
What it does it guarantee that the document has been mapped, but not that the mapped values has been reduced.
Since map/reduce queries, by their nature, tend to be far less susceptible to issues with staleness, this is
considered to be an acceptable tradeoff.
If you need absolute no staleness with a map/reduce index, you will need to ensure synchronized clocks and
use the Cutoff date option, instead.public IDocumentQueryCustomization waitForNonStaleResultsAsOf(Etag cutOffEtag, long waitTimeout)
IDocumentQueryCustomization
waitForNonStaleResultsAsOf
in interface IDocumentQueryCustomization
cutOffEtag
- Cutoff etag is used to check if the index has already process a document with the given
etag. Unlike Cutoff, which uses dates and is susceptible to clock synchronization issues between
machines, cutoff etag doesn't rely on both the server and client having a synchronized clock and
can work without it.
However, when used to query map/reduce indexes, it does NOT guarantee that the document that this
etag belong to is actually considered for the results.
What it does it guarantee that the document has been mapped, but not that the mapped values has been reduced.
Since map/reduce queries, by their nature, tend to be far less susceptible to issues with staleness, this is
considered to be an acceptable tradeoff.
If you need absolute no staleness with a map/reduce index, you will need to ensure synchronized clocks and
use the Cutoff date option, instead.waitTimeout
- Maximum time to wait for index query results to become non-stale before exception is thrown.public IDocumentQueryCustomization waitForNonStaleResults()
IDocumentQueryCustomization
waitForNonStaleResults
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization include(com.mysema.query.types.Path<?> path)
IDocumentQueryCustomization
include
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization include(String path)
IDocumentQueryCustomization
include
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization include(Class<?> targetClass, com.mysema.query.types.Path<?> path)
IDocumentQueryCustomization
include
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization waitForNonStaleResults(long waitTimeout)
IDocumentQueryCustomization
waitForNonStaleResults
in interface IDocumentQueryCustomization
waitTimeout
- Maximum time to wait for index query results to become non-stale before exception is thrown.public IDocumentQueryCustomization withinRadiusOf(double radius, double latitude, double longitude)
IDocumentQueryCustomization
withinRadiusOf
in interface IDocumentQueryCustomization
radius
- Radius (in kilometers) in which matches should be found.latitude
- Latitude pointing to a circle center.longitude
- Longitude pointing to a circle center.public IDocumentQueryCustomization withinRadiusOf(String fieldName, double radius, double latitude, double longitude)
IDocumentQueryCustomization
withinRadiusOf
in interface IDocumentQueryCustomization
fieldName
- Spatial field name.radius
- Radius (in kilometers) in which matches should be found.latitude
- Latitude pointing to a circle center.longitude
- Longitude pointing to a circle center.public IDocumentQueryCustomization withinRadiusOf(double radius, double latitude, double longitude, SpatialOptions.SpatialUnits radiusUnits)
IDocumentQueryCustomization
withinRadiusOf
in interface IDocumentQueryCustomization
radius
- Radius (measured in units passed to radiusUnits parameter) in which matches should be found.latitude
- Latitude poiting to a circle center.longitude
- Longitude poiting to a circle center.radiusUnits
- Units that will be used to measure distances (Kilometers, Miles).public IDocumentQueryCustomization withinRadiusOf(String fieldName, double radius, double latitude, double longitude, SpatialOptions.SpatialUnits radiusUnits)
IDocumentQueryCustomization
withinRadiusOf
in interface IDocumentQueryCustomization
fieldName
- Spatial field name.radius
- Radius (measured in units passed to radiusUnits parameter) in which matches should be found.latitude
- Latitude pointing to a circle center.longitude
- Longitude pointing to a circle center.radiusUnits
- Units that will be used to measure distances (Kilometers, Miles).public IDocumentQueryCustomization relatesToShape(String fieldName, String shapeWKT, SpatialOptions.SpatialRelation rel)
IDocumentQueryCustomization
relatesToShape
in interface IDocumentQueryCustomization
fieldName
- The name of the field containing the shape to use for filteringshapeWKT
- The query shaperel
- Spatial relation to checkpublic IDocumentQueryCustomization spatial(String fieldName, SpatialCriteria criteria)
IDocumentQueryCustomization
spatial
in interface IDocumentQueryCustomization
fieldName
- Spatial field name.criteria
- Function with spatial criteria factorypublic IDocumentQueryCustomization showTimings()
IDocumentQueryCustomization
showTimings
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization sortByDistance()
IDocumentQueryCustomization
sortByDistance
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization sortByDistance(double lat, double lng)
IDocumentQueryCustomization
sortByDistance
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization sortByDistance(double lat, double lng, String sortedFieldName)
IDocumentQueryCustomization
sortByDistance
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization randomOrdering()
IDocumentQueryCustomization
randomOrdering
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization randomOrdering(String seed)
IDocumentQueryCustomization
randomOrdering
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization customSortUsing(String typeName)
IDocumentQueryCustomization
customSortUsing
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization customSortUsing(String typeName, boolean descending)
IDocumentQueryCustomization
customSortUsing
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization beforeQueryExecution(Action1<IndexQuery> action)
IDocumentQueryCustomization
beforeQueryExecution
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization highlight(String fieldName, int fragmentLength, int fragmentCount, String fragmentsField)
IDocumentQueryCustomization
highlight
in interface IDocumentQueryCustomization
fieldName
- The field name to highlight.fragmentLength
- The fragment length.fragmentCount
- The maximum number of fragments for the field.fragmentsField
- The field in query results item to put highlightings into.public IDocumentQueryCustomization highlight(String fieldName, int fragmentLength, int fragmentCount, Reference<FieldHighlightings> highlightings)
IDocumentQueryCustomization
highlight
in interface IDocumentQueryCustomization
fieldName
- The field name to highlight.fragmentLength
- The fragment length.fragmentCount
- The maximum number of fragments for the field.highlightings
- Field highlightings for all results.public IDocumentQueryCustomization highlight(String fieldName, String fieldKeyName, int fragmentLength, int fragmentCount, Reference<FieldHighlightings> highlightings)
IDocumentQueryCustomization
highlight
in interface IDocumentQueryCustomization
fieldName
- The field name to highlight.fragmentLength
- The fragment length.fragmentCount
- The maximum number of fragments for the field.highlightings
- Field highlightings for all results.public IDocumentQueryCustomization setAllowMultipleIndexEntriesForSameDocumentToResultTransformer(boolean value)
IDocumentQueryCustomization
setAllowMultipleIndexEntriesForSameDocumentToResultTransformer
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization setHighlighterTags(String preTag, String postTag)
IDocumentQueryCustomization
setHighlighterTags
in interface IDocumentQueryCustomization
preTag
- Prefix tag.postTag
- Postfix tag.public IDocumentQueryCustomization setHighlighterTags(String[] preTags, String[] postTags)
IDocumentQueryCustomization
setHighlighterTags
in interface IDocumentQueryCustomization
preTags
- Prefix tags.postTags
- Postfix tags.public IDocumentQueryCustomization noTracking()
IDocumentQueryCustomization
noTracking
in interface IDocumentQueryCustomization
public IDocumentQueryCustomization noCaching()
IDocumentQueryCustomization
noCaching
in interface IDocumentQueryCustomization
Copyright © 2016. All Rights Reserved.