Package com.yahoo.search.query
Class Model
java.lang.Object
com.yahoo.search.query.Model
- All Implemented Interfaces:
Cloneable
The parameters defining the recall of a query.
- Author:
- Arne Bergene Fossaa, bratseth
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final com.yahoo.processing.request.CompoundName
The name of the query property used for generating hit count estimate queries.static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the parsed query such that it will be created anew from the textual representation (a query string or select.where expression) on the next access.clone()
boolean
static QueryProfileType
Returns the default index for this query.Returns the name of the document db this should search, or null if not set.Returns the encoding used in the query as a lowercase stringReturns the Execution working on this, or a null execution if none.Returns the filter string set for this query.static Model
com.yahoo.language.Language
Returns the explicitly set parsing language of this query model, or null if noneReturns the explicitly set parsing locale of this query model, or null if none.Returns the query owning this, never nullcom.yahoo.language.Language
com.yahoo.language.Language
getParsingLanguage
(String languageDetectionText) Gets the language to use for parsing.Returns the query string which caused the original query tree of this model to come about.Returns the query as an object structure.Returns the set of types this query will search.Returns the set of sources this query will search.getType()
Sets the query type of for this query.int
hashCode()
void
Prepares this for binary serialization.void
setDefaultIndex
(String defaultIndex) Sets the default index for this query.void
setDocumentDb
(String documentDbName) Sets the document database this will search - a document typevoid
setEncoding
(String encoding) Sets the encoding which was used in the received query stringvoid
setExecution
(Execution execution) Sets the execution working on this.void
Sets the filter string set for this query.void
setLanguage
(com.yahoo.language.Language language) Explicitly sets the language to be used during parsingvoid
setLanguage
(String language) Explicitly sets the language to be used during parsing.void
Explicitly sets the locale to be used during parsing.void
Explicitly sets the locale to be used during parsing.void
Assigns the query owning thisvoid
setQueryString
(String queryString) Set the query from a string.void
setRestrict
(String restrictString) Sets the set of types (document type or search definition names) this query will search from a comma-separated string of type names.void
setSearchPath
(String searchPath) Set the path for which content nodes this query should go to - seevoid
setSources
(String sourceString) Sets the set of sources this query will search from a comma-separated string of source namesvoid
setType
(Query.Type type) Sets the query type of for this query.void
Sets the query type of for this query.toString()
-
Field Details
-
MODEL
- See Also:
-
PROGRAM
- See Also:
-
QUERY_STRING
- See Also:
-
TYPE
- See Also:
-
FILTER
- See Also:
-
DEFAULT_INDEX
- See Also:
-
LANGUAGE
- See Also:
-
LOCALE
- See Also:
-
ENCODING
- See Also:
-
SOURCES
- See Also:
-
SEARCH_PATH
- See Also:
-
RESTRICT
- See Also:
-
ESTIMATE
public static final com.yahoo.processing.request.CompoundName ESTIMATEThe name of the query property used for generating hit count estimate queries.
-
-
Constructor Details
-
Model
-
-
Method Details
-
getArgumentType
-
getParsingLanguage
public com.yahoo.language.Language getParsingLanguage() -
getParsingLanguage
Gets the language to use for parsing. If this is explicitly set in the model, that language is returned. Otherwise, if a query tree is already produced and any node in it specifies a language the first such node encountered in a depth first left to right search is returned. Otherwise the language is guessed from the query string. If this does not yield an actual language, English is returned as the default.- Returns:
- the language determined, never null
-
getLanguage
public com.yahoo.language.Language getLanguage()Returns the explicitly set parsing language of this query model, or null if none -
setLanguage
public void setLanguage(com.yahoo.language.Language language) Explicitly sets the language to be used during parsing -
setLanguage
Explicitly sets the language to be used during parsing. The argument is first normalized by replacing underscores with hyphens (to support locale strings being used as RFC 5646 language tags), and then forwarded tosetLocale(String)
so that the Locale information of the tag is preserved.- Parameters:
language
- The language string to parse.- See Also:
-
getLocale
Returns the explicitly set parsing locale of this query model, or null if none.- Returns:
- the locale of this
- See Also:
-
setLocale
Explicitly sets the locale to be used during parsing. This method also callssetLanguage(Language)
with the correspondingLanguage
instance.- Parameters:
locale
- the locale to set- See Also:
-
setLocale
Explicitly sets the locale to be used during parsing. This creates a Locale instance from the given language tag, and passes that tosetLocale(Locale)
.- Parameters:
languageTag
- the language tag to parse- See Also:
-
getEncoding
Returns the encoding used in the query as a lowercase string -
setEncoding
Sets the encoding which was used in the received query string -
setSearchPath
Set the path for which content nodes this query should go to - see -
getSearchPath
-
setQueryString
Set the query from a string. This will not be parsed into a query tree until that tree is attempted accessed. Note that setting this will clear the current query tree. Usually, this should not be modified - changes to the query should be implemented as modifications on the query tree structure.Passing null causes this to be set to an empty string.
-
getQueryString
Returns the query string which caused the original query tree of this model to come about. Note that changes to the query tree are not reflected in this query string. Note that changes to the query tree are not reflected in this query string.- Returns:
- the original (or reassigned) query string - never null
-
getQueryTree
Returns the query as an object structure. Remember to have the correct Query.Type set. This causes parsing of the query string if it has changed since this was last called (i.e query parsing is lazy) -
clearQueryTree
public void clearQueryTree()Clears the parsed query such that it will be created anew from the textual representation (a query string or select.where expression) on the next access. -
getFilter
Returns the filter string set for this query. The filter is included in the query tree at the time the query tree is parsed -
setFilter
Sets the filter string set for this query. The filter is included in the query tree at the time the query tree is parsed. Setting this does not cause the query to be reparsed. -
getDefaultIndex
Returns the default index for this query. The default index is taken into account at the time the query tree is parsed. -
setDefaultIndex
Sets the default index for this query. The default index is taken into account at the time the query tree is parsed. Setting this does not cause the query to be reparsed. -
getType
Sets the query type of for this query. The type is taken into account at the time the query tree is parsed. -
setType
Sets the query type of for this query. The type is taken into account at the time the query tree is parsed. Setting this does not cause the query to be reparsed. -
setType
Sets the query type of for this query. The type is taken into account at the time the query tree is parsed. Setting this does not cause the query to be reparsed. -
equals
-
hashCode
public int hashCode() -
clone
-
cloneFor
-
getParent
Returns the query owning this, never null -
setParent
Assigns the query owning this -
setSources
Sets the set of sources this query will search from a comma-separated string of source names -
getSources
Returns the set of sources this query will search. This set can be modified to change the set of sources. If all sources are to be searched, this returns an empty set- Returns:
- the set of sources to search, never null
-
setRestrict
Sets the set of types (document type or search definition names) this query will search from a comma-separated string of type names. This is useful to narrow a search to just a subset of the types available from a sources -
getRestrict
Returns the set of types this query will search. This set can be modified to change the set of types. If all types are to be searched, this returns an empty set.- Returns:
- the set of types to search, never null
-
setExecution
Sets the execution working on this. For internal use. -
setDocumentDb
Sets the document database this will search - a document type -
getDocumentDb
Returns the name of the document db this should search, or null if not set. -
getExecution
Returns the Execution working on this, or a null execution if none. For internal use. -
getFrom
-
toString
-
prepare
Prepares this for binary serialization. For internal use.
-