public class Query extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Query.QueryType |
static class |
Query.RemoveWordsType |
static class |
Query.TypoTolerance |
| Constructor and Description |
|---|
Query() |
Query(Query other) |
Query(String query) |
| Modifier and Type | Method and Description |
|---|---|
Query |
addInsidePolygon(float latitude,
float longitude)
Add a point to the polygon of geo-search (requires a minimum of three points to define a valid polygon)
At indexing, you should specify geoloc of an object with the _geoloc attribute (in the form "_geoloc":{"lat":48.853409, "lng":2.348800} or
"_geoloc":[{"lat":48.853409, "lng":2.348800},{"lat":48.547456, "lng":2.972075}] if you have several geo-locations in your record).
|
Query |
aroundLatitudeLongitude(float latitude,
float longitude)
Search for entries around a given latitude/longitude with an automatic radius computed depending of the density of the area.
|
Query |
aroundLatitudeLongitude(float latitude,
float longitude,
int radius)
Search for entries around a given latitude/longitude.
|
Query |
aroundLatitudeLongitude(float latitude,
float longitude,
int radius,
int precision)
Search for entries around a given latitude/longitude.
|
Query |
aroundLatitudeLongitudeViaIP(boolean enabled)
Search for entries around the latitude/longitude of user (using IP
geolocation) with an automatic radius depending on area density
|
Query |
aroundLatitudeLongitudeViaIP(boolean enabled,
int radius)
Search for entries around the latitude/longitude of user (using IP
geolocation)
|
Query |
aroundLatitudeLongitudeViaIP(boolean enabled,
int radius,
int precision)
Search for entries around the latitude/longitude of user (using IP
geolocation)
|
Query |
disableTypoToleranceOnAttributes(List<String> attributes) |
Query |
enableAnalytics(boolean enabled) |
Query |
enableAvancedSyntax(boolean advancedSyntax)
Enable the advanced query syntax.
|
Query |
enableDistinct(boolean distinct) |
Query |
enableDistinct(int nbHitsToKeep)
This feature is similar to the distinct just before but instead of
keeping the best value per value of attributeForDistinct, it allows to
keep N values.
|
Query |
enableRemoveStopWords(boolean removeStopWords)
Enable the removal of stop words.
|
Query |
enableRemoveStopWords(String removeStopWords)
Enable to pass a list of ISO codes
|
Query |
enableReplaceSynonymsInHighlight(boolean enabled) |
Query |
enableSynonyms(boolean enabled) |
Query |
enableTyposOnNumericTokens(boolean enabled) |
Query |
enableTypoTolerance(boolean enabled) |
String |
getAnalyticsTags() |
String |
getAroundLatLong() |
List<String> |
getAttributes() |
List<String> |
getAttributesToHighlight() |
List<String> |
getAttributesToSnippet() |
Integer |
getDistinct() |
String |
getFacetFilters() |
String |
getFacets() |
String |
getFilters() |
Integer |
getHitsPerPage() |
String |
getInsideBoundingBox() |
Integer |
getMaxNumberOfFacets() |
Integer |
getMinWordSizeForApprox1() |
Integer |
getMinWordSizeForApprox2() |
String |
getNumerics() |
String |
getOptionalWords() |
Integer |
getPage() |
String |
getQuery() |
protected String |
getQueryString() |
Query.QueryType |
getQueryType() |
Query |
getRankingInfo(boolean enabled)
if set, the result hits will contain ranking information in _rankingInfo
attribute.
|
Query.RemoveWordsType |
getRemoveWordsIfNoResult() |
String |
getRestrictIndices() |
String |
getRestrictSearchableAttributes() |
String |
getRestrictSources()
Restrict calls on the API only from this IP range
|
String |
getSimilarQuery() |
String |
getTags() |
Query.TypoTolerance |
getTypoTolerance() |
Integer |
getValidUntil() |
Query |
ignorePlural(boolean enabled)
If set to true, plural won't be considered as a typo (for example
car/cars will be considered as equals).
|
Query |
insideBoundingBox(float latitudeP1,
float longitudeP1,
float latitudeP2,
float longitudeP2)
Search for entries inside a given area defined by the two extreme points of a rectangle.
|
Boolean |
isAdvancedSyntax() |
Boolean |
isAllowTyposOnNumericTokens() |
Boolean |
isAnalytics() |
Boolean |
isAroundLatLongViaIP() |
Boolean |
isDistinct() |
Boolean |
isGetRankingInfo() |
Boolean |
isIgnorePlural() |
Boolean |
isReplaceSynonyms() |
Boolean |
isSynonyms() |
Query |
removeWordsIfNoResult(Query.RemoveWordsType type)
Select the strategy to adopt when a query does not return any result.
|
Query |
restrictSearchableAttributes(String attributes)
List of object attributes you want to use for textual search (must be a
subset of the attributesToIndex index setting).
|
Query |
setAlternativesAsExact(String alternativesAsExact) |
Query |
setAnalyticsTags(String analyticsTags) |
Query |
setAroundPrecision(int precision)
Change the precision of around latitude/longitude query
|
Query |
setAroundRadius(int radius)
Change the radius of around latitude/longitude query
|
Query |
setAroundRadiusAll()
Change the radius of around latitude/longitude to `all`
|
Query |
setAttributesToHighlight(List<String> attributes)
Specify the list of attribute names to highlight.
|
Query |
setAttributesToRetrieve(List<String> attributes)
Specify the list of attribute names to retrieve.
|
Query |
setAttributesToSnippet(List<String> attributes)
Specify the list of attribute names to Snippet alongside the number of
words to return (syntax is 'attributeName:nbWords').
|
Query |
setExactOnSingleWordQuery(String exactOnSingleWordQuery) |
Query |
setFacetFilters(List<String> facets)
Filter the query by a list of facets.
|
Query |
setFacetFilters(String facetFilters)
Filter the query by a list of facets.
|
Query |
setFacets(List<String> facets)
List of object attributes that you want to use for faceting.
|
Query |
setFilters(String filters)
Filter the query with numeric, facet or/and tag filters.
|
Query |
setHighlightingTags(String preTag,
String postTag) |
Query |
setHitsPerPage(int nbHitsPerPage)
Set the number of hits per page.
|
Query |
setMaxNumberOfFacets(int n)
Limit the number of facet values returned for each facet.
|
Query |
setMinimumAroundRadius(int radius)
Change the minimum radius of around latitude/longitude query
|
Query |
setMinProximity(int value) |
Query |
setMinWordSizeToAllowOneTypo(int nbChars)
Specify the minimum number of characters in a query word to accept one
typo in this word.
|
Query |
setMinWordSizeToAllowTwoTypos(int nbChars)
Specify the minimum number of characters in a query word to accept two
typos in this word.
|
Query |
setNbHitsPerPage(int nbHitsPerPage)
Deprecated.
Use
setHitsPerPage |
Query |
setNumericFilters(List<String> numerics)
Add a list of numeric filters separated by a comma.
|
Query |
setNumericFilters(String numerics)
Add a list of numeric filters separated by a comma.
|
Query |
setOptionalWords(List<String> words)
Set the list of words that should be considered as optional when found in
the query.
|
Query |
setOptionalWords(String words)
Set the list of words that should be considered as optional when found in
the query.
|
Query |
setPage(int page)
Set the page to retrieve (zero base).
|
Query |
setQueryString(String query)
Set the full text query
|
Query |
setQueryType(Query.QueryType type)
Select how the query words are interpreted:
|
Query |
setReferers(String referers)
Set the referers used to restrict the query from a specific website.
|
Query |
setRestrictIndicies(String indices) |
Query |
setRestrictSources(String restrictSources) |
Query |
setSimilarQueryString(String query)
Set the full text similar query string
|
Query |
setSnippetEllipsisText(String snippetEllipsisText)
Specify the string that is used as an ellipsis indicator when a snippet
is truncated (defaults to the empty string).
|
Query |
setTagFilters(String tags)
Filter the query by a set of tags.
|
Query |
setTypoTolerance(Query.TypoTolerance typoTolerance) |
Query |
setUserToken(String userToken)
Set the userToken used as identifier for the ratelimit
|
Query |
setValidUntil(Integer timestamp) |
protected Integer minWordSizeForApprox1
protected Integer minWordSizeForApprox2
protected Boolean getRankingInfo
protected Boolean ignorePlural
protected Integer distinct
protected Boolean advancedSyntax
protected Integer page
protected Integer hitsPerPage
protected String restrictSearchableAttributes
protected String tags
protected String filters
protected String highlightPreTag
protected String highlightPostTag
protected String snippetEllipsisText
protected Integer minProximity
protected String numerics
protected String insideBoundingBox
protected String insidePolygon
protected String aroundLatLong
protected Boolean aroundLatLongViaIP
protected String query
protected String similarQuery
protected Query.QueryType queryType
protected String optionalWords
protected String facets
protected String facetFilters
protected Integer maxNumberOfFacets
protected Boolean analytics
protected Boolean synonyms
protected Boolean replaceSynonyms
protected Boolean allowTyposOnNumericTokens
protected Query.RemoveWordsType removeWordsIfNoResult
protected Query.TypoTolerance typoTolerance
protected String analyticsTags
protected int aroundPrecision
protected Object aroundRadius
protected int minimumAroundRadius
protected Object removeStopWords
protected String userToken
protected String referers
protected Integer validUntil
protected String restrictSources
protected String restrictIndices
protected String exactOnSingleWordQuery
protected String alternativesAsExact
public Query(String query)
public Query()
public Query(Query other)
public Query removeWordsIfNoResult(Query.RemoveWordsType type)
public Query restrictSearchableAttributes(String attributes)
public Query setQueryType(Query.QueryType type)
public Query setSimilarQueryString(String query)
public Query setAttributesToRetrieve(List<String> attributes)
public Query setAttributesToHighlight(List<String> attributes)
public Query disableTypoToleranceOnAttributes(List<String> attributes)
public Query setAttributesToSnippet(List<String> attributes)
public Query enableDistinct(boolean distinct)
distinct - set to true, enable the distinct feature (disabled by default)
if the attributeForDistinct index setting is set. This feature
is similar to the SQL "distinct" keyword: when enabled in a
query with the distinct=1 parameter, all hits containing a
duplicate value for the attributeForDistinct attribute are
removed from results. For example, if the chosen attribute is
show_name and several hits have the same value for show_name,
then only the best one is kept and others are removed.public Query enableDistinct(int nbHitsToKeep)
nbHitsToKeep - Specify the maximum number of hits to keep for each distinct
valuepublic Query enableAnalytics(boolean enabled)
enabled - set to false, this query will not be taken into account in
analytics feature. Default to true.public Query setAnalyticsTags(String analyticsTags)
analyticsTags - the analytics tags identifying the querypublic Query enableSynonyms(boolean enabled)
enabled - set to false, this query will not use synonyms defined in
configuration. Default to true.public Query enableReplaceSynonymsInHighlight(boolean enabled)
enabled - set to false, words matched via synonyms expansion will not be
replaced by the matched synonym in highlight result. Default
to true.public Query enableTypoTolerance(boolean enabled)
enabled - set to false, disable typo-tolerance. Default to true.public Query setTypoTolerance(Query.TypoTolerance typoTolerance)
typoTolerance - option allow to control the number of typo in the results set.public Query setMinWordSizeToAllowOneTypo(int nbChars)
public Query setMinProximity(int value)
public Query setSnippetEllipsisText(String snippetEllipsisText)
public Query setMinWordSizeToAllowTwoTypos(int nbChars)
public Query enableTyposOnNumericTokens(boolean enabled)
enabled - set to false, disable typo-tolerance on numeric tokens.
Default to true.public Query getRankingInfo(boolean enabled)
public Query ignorePlural(boolean enabled)
public Query setPage(int page)
public Query setHitsPerPage(int nbHitsPerPage)
@Deprecated public Query setNbHitsPerPage(int nbHitsPerPage)
setHitsPerPagepublic Query setUserToken(String userToken)
public Query setReferers(String referers)
public Query aroundLatitudeLongitude(float latitude, float longitude)
public Query aroundLatitudeLongitude(float latitude, float longitude, int radius)
radius - set the maximum distance in meters. Note: at indexing, geoloc
of an object should be set with _geoloc attribute containing
lat and lng attributes (for example
{"_geoloc":{"lat":48.853409, "lng":2.348800}})public Query setAroundRadius(int radius)
public Query setAroundRadiusAll()
public Query setMinimumAroundRadius(int radius)
public Query setAroundPrecision(int precision)
public Query aroundLatitudeLongitude(float latitude, float longitude, int radius, int precision)
radius - set the maximum distance in meters (manually defined)precision - set the precision for ranking (for example if you set
precision=100, two objects that are distant of less than 100m
will be considered as identical for "geo" ranking parameter).
Note: at indexing, geoloc of an object should be set with
_geoloc attribute containing lat and lng attributes (for
example {"_geoloc":{"lat":48.853409, "lng":2.348800}})public Query aroundLatitudeLongitudeViaIP(boolean enabled)
public Query aroundLatitudeLongitudeViaIP(boolean enabled, int radius)
radius - set the maximum distance in meters manuallypublic Query aroundLatitudeLongitudeViaIP(boolean enabled, int radius, int precision)
radius - set the maximum distance in meters.precision - set the precision for ranking (for example if you set
precision=100, two objects that are distant of less than 100m
will be considered as identical for "geo" ranking parameter).
Note: at indexing, geoloc of an object should be set with
_geoloc attribute containing lat and lng attributes (for
example {"_geoloc":{"lat":48.853409, "lng":2.348800}})public Query insideBoundingBox(float latitudeP1, float longitudeP1, float latitudeP2, float longitudeP2)
You can use several bounding boxes (OR) by calling this method several times.
public Query addInsidePolygon(float latitude, float longitude)
public Query setOptionalWords(String words)
words - The list of optional words, comma separated.public Query setOptionalWords(List<String> words)
words - The list of optional words.public Query setFilters(String filters)
public Query setFacetFilters(List<String> facets)
public Query setFacetFilters(String facetFilters)
public Query setFacets(List<String> facets)
public Query setMaxNumberOfFacets(int n)
public Query setTagFilters(String tags)
public Query setNumericFilters(String numerics)
public Query setNumericFilters(List<String> numerics)
public Query enableRemoveStopWords(boolean removeStopWords)
public Query enableRemoveStopWords(String removeStopWords)
public Query enableAvancedSyntax(boolean advancedSyntax)
public String getRestrictSources()
protected String getQueryString()
public List<String> getAttributesToHighlight()
public List<String> getAttributesToSnippet()
public Integer getMinWordSizeForApprox1()
public Integer getMinWordSizeForApprox2()
public Boolean isGetRankingInfo()
public Boolean isIgnorePlural()
public Boolean isDistinct()
public Integer getDistinct()
public Boolean isAdvancedSyntax()
public Integer getPage()
public Integer getHitsPerPage()
public String getRestrictSearchableAttributes()
public String getTags()
public String getNumerics()
public String getInsideBoundingBox()
public String getAroundLatLong()
public Boolean isAroundLatLongViaIP()
public String getQuery()
public String getSimilarQuery()
public Query.QueryType getQueryType()
public String getOptionalWords()
public String getFacets()
public String getFilters()
public String getFacetFilters()
public Integer getMaxNumberOfFacets()
public Boolean isAnalytics()
public String getAnalyticsTags()
public Boolean isSynonyms()
public Boolean isReplaceSynonyms()
public Boolean isAllowTyposOnNumericTokens()
public Query.RemoveWordsType getRemoveWordsIfNoResult()
public Query.TypoTolerance getTypoTolerance()
public Integer getValidUntil()
public String getRestrictIndices()
Copyright © 2016. All rights reserved.