@StableMinor(version="12.5", sinceVersion="9.0") public class SearchQuery extends Object
searcher
.IBigDataSearcher
Constructor and Description |
---|
SearchQuery()
|
SearchQuery(String query)
|
Modifier and Type | Method and Description |
---|---|
SearchQuery |
addAggregation(IAggregation aggregation)
Adds the given aggregation in this search query.
|
SearchQuery |
addAggregations(IAggregation... aggregations)
Adds the given aggregations in this search query.
|
SearchQuery |
addAggregations(List<IAggregation> aggregations)
Adds the given aggregations in this search query.
|
SearchQuery |
addDocumentTypeIds(Collection<String> documentTypeIds)
Adds the given document types to the scope for this search query.
|
SearchQuery |
addDocumentTypeIds(String... documentTypes)
Adds the given document types to the scope for this search query.
|
SearchQuery |
addDocumentTypes(Collection<? extends DocumentType> documentTypes)
Adds the given document types to the scope for this search query.
|
SearchQuery |
addDocumentTypes(DocumentType... documentTypes)
Adds the given document types to the scope for this search query.
|
SearchQuery |
addFieldBoost(DocumentTypeField documentTypeField,
float boost)
Adds a field boost to search.
|
SearchQuery |
addFieldBoost(String fieldId,
float boost)
Adds a field boost to search.
|
SearchQuery |
addSort(ISearchQuerySort sort)
Adds a sort definition in this search.
|
List<IAggregation> |
getAggregations()
Returns an unmodifiable list of the added aggregations.
|
ISearchQueryFilter |
getControlFilter()
Returns a query filter to be applied to the search.
|
Set<String> |
getDocumentTypeIds()
Returns the identifiers of document types set as the scope for this search query.
|
Map<DocumentTypeField,Float> |
getFieldsBoost()
Returns the field boosting configuration.
|
HighlightConfig |
getHighlight()
Returns the highlight configuration.
|
int |
getMaxRows()
|
List<ISearchQuerySort> |
getSorts()
Returns an unmodifiable list of added sorts.
|
int |
getStartAt()
|
String |
getUserQuery()
Returns the user query, which is the user-defined portion of the
query , usually entered by
the final user using front-end interfaces. |
SearchQuery |
setControlFilter(ISearchQueryFilter controlFilter)
Sets the query filter to be applied to the search.
|
SearchQuery |
setHighlight(HighlightConfig highlight)
Sets the highlight configuration.
|
SearchQuery |
setMaxRows(int maxRows)
Sets the
maximum number of hits . |
SearchQuery |
setStartAt(int startAt)
Sets the
number of the first hit .This number is 1-based (the first result is the result number 1). |
SearchQuery |
setUserQuery(String query)
Sets the
user query . |
public SearchQuery()
public SearchQuery(String query)
query
- {@link #getUserQuery() user querypublic String getUserQuery()
query
, usually entered by
the final user using front-end interfaces.
The searcher
can and usually perform a tokenization in the user query in the same way
they do in the contents
during the indexing process.
public SearchQuery setUserQuery(String query)
user query
.query
- the user query
. If the given user query is a blank string or null
, it is equivalent
to not having an user query.public int getMaxRows()
hits
to be returned by the query
execution
.
Usually this setting is used to paginate the search results
.
public SearchQuery setMaxRows(int maxRows)
maximum number of hits
.maxRows
- the maximum number of hitspublic int getStartAt()
hit
to be returned by the query
execution
.
Usually this setting is used to paginate the search results
.
This number is 1-based (the first result is the result number 1).
hit
public SearchQuery setStartAt(int startAt)
number of the first hit
.startAt
- the number of the first hit
public ISearchQueryFilter getControlFilter()
null
if none was specified.#getControlQuery()
public SearchQuery setControlFilter(ISearchQueryFilter controlFilter)
the
- query filter.#setControlQuery(String)
public SearchQuery addSort(ISearchQuerySort sort)
sort
- the sort definition.public List<ISearchQuerySort> getSorts()
public SearchQuery setHighlight(HighlightConfig highlight)
highlight
- the highlight configuration.public HighlightConfig getHighlight()
public SearchQuery addAggregation(IAggregation aggregation)
aggregation
- the aggregation.public SearchQuery addAggregations(IAggregation... aggregations)
aggregations
- the aggregations.public SearchQuery addAggregations(List<IAggregation> aggregations)
aggregations
- the aggregations.public List<IAggregation> getAggregations()
public SearchQuery addFieldBoost(String fieldId, float boost) throws PortalObjectNotFoundException
a user query
is present in search query.fieldId
- the identifier of the field to be boosted.boost
- the boost value.PortalObjectNotFoundException
- if no field with the given identifier could be found.public SearchQuery addFieldBoost(DocumentTypeField documentTypeField, float boost)
a user query
is present in search query.documentTypeField
- the field to be boosted.boost
- the boost value.PortalObjectNotFoundException
- if no field with the given identifier could be found.IllegalArgumentException
- if the field is not indexed.IllegalArgumentException
- if the boost value is not positive.DocumentTypeField.getIndexMode()
public SearchQuery addDocumentTypes(DocumentType... documentTypes)
By default a search query searches in all existing document types, but if any document type is added to the search query, it will limit its search to the added document types.
documentTypes
- the document types to add.public SearchQuery addDocumentTypes(Collection<? extends DocumentType> documentTypes)
By default a search query searches in all existing document types, but if any document type is added to the search query, it will limit its search to the added document types.
documentTypes
- the document types to add.public SearchQuery addDocumentTypeIds(String... documentTypes)
By default a search query searches in all existing document types, but if any document type is added to the search query, it will limit its search to the added document types.
documentTypeIds
- the identifiers of document types to add.public SearchQuery addDocumentTypeIds(Collection<String> documentTypeIds)
By default a search query searches in all existing document types, but if any document type is added to the search query, it will limit its search to the added document types.
documentTypeIds
- the identifiers of document types to add.public Set<String> getDocumentTypeIds()
public Map<DocumentTypeField,Float> getFieldsBoost()
LumisXP 12.5.0.200928 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.