org.apache.maven.index
Class DefaultQueryCreator

java.lang.Object
  extended by org.apache.maven.index.DefaultQueryCreator
All Implemented Interfaces:
QueryCreator

@Component(role=QueryCreator.class)
public class DefaultQueryCreator
extends Object
implements QueryCreator

A default QueryCreator constructs Lucene query for provided query text.

By default wildcards are created such as query text matches beginning of the field value or beginning of the class/package name segment for NAMES field. But it can be controlled by using special markers:

For example:

Author:
Eugene Kuleshov

Field Summary
 
Fields inherited from interface org.apache.maven.index.QueryCreator
ROLE
 
Constructor Summary
DefaultQueryCreator()
           
 
Method Summary
 org.apache.lucene.search.Query constructQuery(Field field, IndexerField indexerField, String query, SearchType type)
           
 org.apache.lucene.search.Query constructQuery(Field field, SearchExpression expression)
          Constructs query by parsing the query string, using field as default field.
 org.apache.lucene.search.Query constructQuery(Field field, String query, SearchType type)
          Constructs query by parsing the query string, using field as default field.
 org.apache.lucene.search.Query constructQuery(String field, String query)
          Deprecated. 
protected  int countTerms(IndexerField indexerField, String query)
           
protected  org.codehaus.plexus.logging.Logger getLogger()
           
 org.apache.lucene.search.Query legacyConstructQuery(String field, String query)
           
 IndexerField selectIndexerField(Field field, SearchType type)
          Performs a selection of the appropriate IndexerField belonging to proper Field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultQueryCreator

public DefaultQueryCreator()
Method Detail

getLogger

protected org.codehaus.plexus.logging.Logger getLogger()

selectIndexerField

public IndexerField selectIndexerField(Field field,
                                       SearchType type)
Description copied from interface: QueryCreator
Performs a selection of the appropriate IndexerField belonging to proper Field.

Specified by:
selectIndexerField in interface QueryCreator
Returns:

constructQuery

public org.apache.lucene.search.Query constructQuery(Field field,
                                                     SearchExpression expression)
                                              throws org.apache.lucene.queryParser.ParseException
Description copied from interface: QueryCreator
Constructs query by parsing the query string, using field as default field. This method should be use to construct queries (single term or phrase queries) against single field.

Specified by:
constructQuery in interface QueryCreator
Returns:
Throws:
org.apache.lucene.queryParser.ParseException - if query parsing is unsuccessful.

constructQuery

public org.apache.lucene.search.Query constructQuery(Field field,
                                                     String query,
                                                     SearchType type)
                                              throws org.apache.lucene.queryParser.ParseException
Description copied from interface: QueryCreator
Constructs query by parsing the query string, using field as default field. This method should be use to construct queries (single term or phrase queries) against single field.

Specified by:
constructQuery in interface QueryCreator
Returns:
Throws:
org.apache.lucene.queryParser.ParseException - if query parsing is unsuccessful.

constructQuery

@Deprecated
public org.apache.lucene.search.Query constructQuery(String field,
                                                                String query)
Deprecated. 

Description copied from interface: QueryCreator
Deprecated. Avoid it's use! Constructs query against single field, using it's "best effort" approach to perform parsing, but letting caller to apply it's (usually wrong) knowledge about how field is indexed.

Specified by:
constructQuery in interface QueryCreator
Returns:
query if successfully parsed, or null.

constructQuery

public org.apache.lucene.search.Query constructQuery(Field field,
                                                     IndexerField indexerField,
                                                     String query,
                                                     SearchType type)
                                              throws org.apache.lucene.queryParser.ParseException
Throws:
org.apache.lucene.queryParser.ParseException

legacyConstructQuery

public org.apache.lucene.search.Query legacyConstructQuery(String field,
                                                           String query)

countTerms

protected int countTerms(IndexerField indexerField,
                         String query)


Copyright © 2002-2012 The Apache Software Foundation. All Rights Reserved.