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
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final com.yahoo.processing.request.CompoundNameThe name of the query property used for generating hit count estimate queries.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClears 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()booleanstatic QueryProfileTypeReturns 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 Modelcom.yahoo.language.LanguageReturns 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.Languagecom.yahoo.language.LanguagegetParsingLanguage(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.getQueryTree(boolean parse) Returns the query as an object structure.Returns the detailed query type of for this query.Returns the set of types this query will search.Returns the set of sources this query will search.getType()Returns the query type of for this query.inthashCode()voidPrepares this for binary serialization.voidsetDefaultIndex(String defaultIndex) Sets the default index for this query.voidsetDocumentDb(String documentDbName) Sets the document database this will search - a document typevoidsetEncoding(String encoding) Sets the encoding which was used in the received query stringvoidsetExecution(Execution execution) Sets the execution working on this.voidSets the filter string set for this query.voidsetLanguage(com.yahoo.language.Language language) Explicitly sets the language to be used during parsingvoidsetLanguage(String language) Explicitly sets the language to be used during parsing.voidExplicitly sets the locale to be used during parsing.voidExplicitly sets the locale to be used during parsing.voidAssigns the query owning thisvoidsetQueryString(String queryString) Set the query from a string.voidsetRestrict(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.voidsetSearchPath(String searchPath) Set the path for which content nodes this query should go to - seevoidsetSources(String sourceString) Sets the set of sources this query will search from a comma-separated string of source namesvoidSets the query type of this query.voidsetType(Query.Type type) Sets the query type of this query to the QueryType of the given type (such that any QueryType settings are deplaced by this).voidSets the query type of 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 correspondingLanguageinstance.- 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.- 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). -
getQueryTree
Returns the query as an object structure.- Parameters:
parse- if true, the query string is parsed into a query tree if it is currently null, if false, the query string is ignored and the query tree is initialized to an empty root if it's currently null.
-
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
Returns the query type of for this query. The type is taken into account at the time the query tree is parsed. -
getQueryType
Returns the detailed 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 this query to the QueryType of the given type (such that any QueryType settings are deplaced by this). 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 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 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.
-