[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE : [sdx-developers] QueryParser... encore
From: |
Rasik Pandey |
Subject: |
RE : [sdx-developers] QueryParser... encore |
Date: |
Thu, 18 Sep 2003 18:58:47 +0200 |
Salut,
>Tel que rédigé, le queryParser me crée donc des phraseQuery
>alors que je voudrais des termQuery combinées pour les termes
>ayant un positionIncrement de 0 ou, peut-être une
>MultiTermQuery dont m'usage m'est moins familier. Comme
>pensez-vous que le problème puisse être résolu ?
/**
* Factory method for generating a query (similar to
* (address@hidden #getWildcardQuery}). Called when parser parses an input
term
* token that uses prefix notation; that is, contains a single '*'
wildcard
* character as its last character. Since this is a special case
* of generic wildcard term, and such a query can be optimized easily,
* this usually results in a different query object.
*<p>
* Depending on settings, a prefix term may be lower-cased
* automatically. It will not go through the default Analyzer,
* however, since normal Analyzers are unlikely to work properly
* with wildcard templates.
*<p>
* Can be overridden by extending classes, to provide custom handling
for
* wild card queries, which may be necessary due to missing analyzer
calls.
*
* @param field Name of the field query will use.
* @param termStr Term token to use for building term for the query
* (<b>without</b> trailing '*' character!)
*
* @return Resulting address@hidden Query} built for the term
*/
protected Query getPrefixQuery(String field, String termStr)
{
if (lowercaseWildcardTerms) {
termStr = termStr.toLowerCase();
}
Term t = new Term(field, termStr);
return new PrefixQuery(t);
}
OU
/**
* Factory method for generating a query (similar to
* (address@hidden #getWildcardQuery}). Called when parser parses
* an input term token that has the fuzzy suffix (~) appended.
*
* @param field Name of the field query will use.
* @param termStr Term token to use for building term for the query
*
* @return Resulting address@hidden Query} built for the term
*/
protected Query getFuzzyQuery(String field, String termStr)
{
Term t = new Term(field, termStr);
return new FuzzyQuery(t);
}
Rasik