Class SearchEngineClient.SearchConditionBuilder
java.lang.Object
org.codelibs.fess.opensearch.client.SearchEngineClient.SearchConditionBuilder
- Enclosing class:
SearchEngineClient
Builder class for constructing search conditions and parameters.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FacetInfoFacet configuration for aggregationsprotected GeoInfoGeographic search informationprotected HighlightInfoHighlighting configurationprotected booleanWhether scroll mode is enabled for large result setsprotected FloatMinimum score threshold for resultsprotected intSearch result offset (number of results to skip)protected StringThe search query stringprotected String[]Fields to include in the responseprotected final org.opensearch.action.search.SearchRequestBuilderThe search request builder being configuredprotected SearchRequestParams.SearchRequestTypeType of search requestprotected StringHash of document for similarity searchprotected intMaximum number of results to returnprotected StringTrack total hits configuration -
Method Summary
Modifier and TypeMethodDescriptionbooleanbuild()Builds the search request with all configured parameters.builder(org.opensearch.action.search.SearchRequestBuilder searchRequestBuilder) Creates a new SearchConditionBuilder instance.protected voidbuildFacet(QueryHelper queryHelper, QueryFieldConfig queryFieldConfig, org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the facet aggregations.protected voidbuildHighlighter(QueryHelper queryHelper, QueryFieldConfig queryFieldConfig, org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the highlighting configuration.protected voidbuildMinScore(org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the minimum score configuration.protected QueryContextbuildQueryContext(QueryHelper queryHelper, QueryFieldConfig queryFieldConfig, org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the query context with all search parameters.protected voidbuildRescorer(QueryHelper queryHelper, QueryFieldConfig queryFieldConfig, org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the rescorer configuration.protected voidbuildSort(QueryContext queryContext, QueryFieldConfig queryFieldConfig, org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the sort configuration.protected voidbuildTrackTotalHits(org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the track total hits configuration.Gets the current search condition as a map.Sets the facet information for aggregations.Sets the geographic search information.protected org.opensearch.search.collapse.CollapseBuildergetCollapseBuilder(org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Gets the collapse builder for result grouping.highlightInfo(HighlightInfo highlightInfo) Sets the highlighting information.Sets the minimum score threshold for results.offset(int offset) Sets the search result offset.Sets the search query string.responseFields(String[] responseFields) Sets the fields to include in the response.scroll()Enables scroll mode for large result sets.searchRequestType(SearchRequestParams.SearchRequestType searchRequestType) Sets the search request type.similarDocHash(String similarDocHash) Sets the similar document hash for similarity search.size(int size) Sets the maximum number of results to return.trackTotalHits(String trackTotalHits) Sets the track total hits configuration.
-
Field Details
-
searchRequestBuilder
protected final org.opensearch.action.search.SearchRequestBuilder searchRequestBuilderThe search request builder being configured -
query
The search query string -
responseFields
Fields to include in the response -
offset
protected int offsetSearch result offset (number of results to skip) -
size
protected int sizeMaximum number of results to return -
geoInfo
Geographic search information -
facetInfo
Facet configuration for aggregations -
highlightInfo
Highlighting configuration -
similarDocHash
Hash of document for similarity search -
searchRequestType
Type of search request -
isScroll
protected boolean isScrollWhether scroll mode is enabled for large result sets -
trackTotalHits
Track total hits configuration -
minScore
Minimum score threshold for results
-
-
Method Details
-
builder
public static SearchEngineClient.SearchConditionBuilder builder(org.opensearch.action.search.SearchRequestBuilder searchRequestBuilder) Creates a new SearchConditionBuilder instance.- Parameters:
searchRequestBuilder- the search request builder to configure- Returns:
- a new SearchConditionBuilder instance
-
condition
Gets the current search condition as a map.- Returns:
- a map containing the search condition parameters
-
query
Sets the search query string.- Parameters:
query- the query string- Returns:
- this builder for method chaining
-
searchRequestType
public SearchEngineClient.SearchConditionBuilder searchRequestType(SearchRequestParams.SearchRequestType searchRequestType) Sets the search request type.- Parameters:
searchRequestType- the search request type- Returns:
- this builder for method chaining
-
responseFields
Sets the fields to include in the response.- Parameters:
responseFields- the fields to include in the response- Returns:
- this builder for method chaining
-
offset
Sets the search result offset.- Parameters:
offset- the number of results to skip- Returns:
- this builder for method chaining
-
size
Sets the maximum number of results to return.- Parameters:
size- the maximum number of results- Returns:
- this builder for method chaining
-
geoInfo
Sets the geographic search information.- Parameters:
geoInfo- the geographic search information- Returns:
- this builder for method chaining
-
highlightInfo
Sets the highlighting information.- Parameters:
highlightInfo- the highlighting configuration- Returns:
- this builder for method chaining
-
similarDocHash
Sets the similar document hash for similarity search.- Parameters:
similarDocHash- the hash of the document to find similar documents to- Returns:
- this builder for method chaining
-
facetInfo
Sets the facet information for aggregations.- Parameters:
facetInfo- the facet configuration- Returns:
- this builder for method chaining
-
scroll
Enables scroll mode for large result sets.- Returns:
- this builder for method chaining
-
trackTotalHits
Sets the track total hits configuration.- Parameters:
trackTotalHits- the track total hits setting- Returns:
- this builder for method chaining
-
minScore
Sets the minimum score threshold for results.- Parameters:
minScore- the minimum score threshold- Returns:
- this builder for method chaining
-
build
public boolean build()Builds the search request with all configured parameters.- Returns:
- true if the build was successful, false if the query is blank
- Throws:
ResultOffsetExceededException- if the offset exceeds the maximum allowedSearchQueryException- if facet fields are invalid
-
buildMinScore
protected void buildMinScore(org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the minimum score configuration.- Parameters:
fessConfig- the Fess configuration
-
buildTrackTotalHits
protected void buildTrackTotalHits(org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the track total hits configuration.- Parameters:
fessConfig- the Fess configuration
-
buildFacet
protected void buildFacet(QueryHelper queryHelper, QueryFieldConfig queryFieldConfig, org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the facet aggregations.- Parameters:
queryHelper- the query helperqueryFieldConfig- the query field configurationfessConfig- the Fess configuration- Throws:
SearchQueryException- if facet fields are invalid
-
buildHighlighter
protected void buildHighlighter(QueryHelper queryHelper, QueryFieldConfig queryFieldConfig, org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the highlighting configuration.- Parameters:
queryHelper- the query helperqueryFieldConfig- the query field configurationfessConfig- the Fess configuration
-
buildSort
protected void buildSort(QueryContext queryContext, QueryFieldConfig queryFieldConfig, org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the sort configuration.- Parameters:
queryContext- the query contextqueryFieldConfig- the query field configurationfessConfig- the Fess configuration
-
buildRescorer
protected void buildRescorer(QueryHelper queryHelper, QueryFieldConfig queryFieldConfig, org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the rescorer configuration.- Parameters:
queryHelper- the query helperqueryFieldConfig- the query field configurationfessConfig- the Fess configuration
-
buildQueryContext
protected QueryContext buildQueryContext(QueryHelper queryHelper, QueryFieldConfig queryFieldConfig, org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Builds the query context with all search parameters.- Parameters:
queryHelper- the query helperqueryFieldConfig- the query field configurationfessConfig- the Fess configuration- Returns:
- the built query context
-
getCollapseBuilder
protected org.opensearch.search.collapse.CollapseBuilder getCollapseBuilder(org.codelibs.fess.mylasta.direction.FessConfig fessConfig) Gets the collapse builder for result grouping.- Parameters:
fessConfig- the Fess configuration- Returns:
- the collapse builder
-