You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by bu...@apache.org on 2009/08/03 05:38:50 UTC
svn commit: r800191 [1/12] - in /lucene/java/trunk: ./ contrib/
contrib/queryparser/ contrib/queryparser/src/ contrib/queryparser/src/java/
contrib/queryparser/src/java/org/ contrib/queryparser/src/java/org/apache/
contrib/queryparser/src/java/org/apac...
Author: buschmi
Date: Mon Aug 3 03:38:44 2009
New Revision: 800191
URL: http://svn.apache.org/viewvc?rev=800191&view=rev
Log:
LUCENE-1567: New flexible QueryParser framework.
Added:
lucene/java/trunk/contrib/queryparser/
lucene/java/trunk/contrib/queryparser/build.xml (with props)
lucene/java/trunk/contrib/queryparser/pom.xml.template (with props)
lucene/java/trunk/contrib/queryparser/src/
lucene/java/trunk/contrib/queryparser/src/java/
lucene/java/trunk/contrib/queryparser/src/java/org/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/Message.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/MessageImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLS.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLSException.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeError.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeException.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryParserHelper.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/FieldConfig.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/FieldConfigListener.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/QueryConfigHandler.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/messages/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/messages/QueryParserMessages.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/messages/QueryParserMessages.properties (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/messages/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/AndQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/AnyQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BooleanQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BoostQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/DeletedQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/FieldQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/FieldableNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/FuzzyQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/GroupQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/MatchAllDocsQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/MatchNoDocsQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ModifierQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/NoTokenFoundQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/OpaqueQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/OrQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ParametricQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ParametricRangeQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/PathQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/PhraseSlopQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/PrefixWildcardQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ProximityQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/QueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/QueryNodeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/QuotedFieldQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/SlopQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/TextableQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/TokenizedPhraseQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/WildcardQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/parser/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/parser/EscapeQuerySyntax.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/parser/SyntaxParser.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/parser/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/processors/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/processors/NoChildOptimizationQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/processors/QueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/processors/QueryNodeProcessorImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/processors/QueryNodeProcessorPipeline.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/processors/RemoveDeletedQueryNodesProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/processors/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/util/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/util/QueryNodeOperation.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/util/UnescapedCharSequence.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/util/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/MultiFieldQueryParserWrapper.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/OriginalQueryParserHelper.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/QueryParserUtil.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/QueryParserWrapper.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/AnyQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/BooleanQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/BoostQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/FieldQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/FuzzyQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/GroupQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/MatchAllDocsQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/MatchNoDocsQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/ModifierQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/MultiPhraseQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/OriginalBooleanQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/OriginalQueryBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/OriginalQueryTreeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/PhraseQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/PrefixWildcardQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/RangeQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/SlopQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/WildcardQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/builders/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/AllowLeadingWildcardAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/AllowLeadingWildcardAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/AnalyzerAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/AnalyzerAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/BoostAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/BoostAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/DateResolutionAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/DateResolutionAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/DefaultOperatorAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/DefaultOperatorAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/DefaultPhraseSlopAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/DefaultPhraseSlopAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/FieldBoostMapAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/FieldBoostMapAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/FieldBoostMapFCListener.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/FieldDateResolutionFCListener.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/FieldDateResolutionMapAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/FieldDateResolutionMapAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/FuzzyAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/FuzzyAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/LocaleAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/LocaleAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/LowercaseExpandedTermsAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/LowercaseExpandedTermsAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/MultiFieldAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/MultiFieldAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/MultiTermRewriteMethodAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/MultiTermRewriteMethodAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/OriginalQueryConfigHandler.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/PositionIncrementsAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/PositionIncrementsAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/RangeCollatorAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/RangeCollatorAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/config/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/nodes/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/nodes/BooleanModifierNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/nodes/MultiPhraseQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/nodes/OriginalBooleanQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/nodes/RangeQueryNode.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/nodes/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/parser/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/parser/EscapeQuerySyntaxImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/parser/JavaCharStream.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/parser/OriginalSyntaxParser.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/parser/OriginalSyntaxParser.jj (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/parser/OriginalSyntaxParserConstants.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/parser/OriginalSyntaxParserTokenManager.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/parser/ParseException.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/parser/Token.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/parser/TokenMgrError.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/parser/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/AllowLeadingWildcardProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/AnalyzerQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/BooleanSingleChildOptimizationQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/BoostQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/DefaultPhraseSlopQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/FuzzyQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/GroupQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/LowercaseExpandedTermsQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/MatchAllDocsQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/MultiFieldQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/OriginalQueryNodeProcessorPipeline.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/ParametricRangeQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/PhraseSlopQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/PrefixWildcardQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/RemoveEmptyNonLeafQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/original/processors/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/package.html (with props)
lucene/java/trunk/contrib/queryparser/src/java/overview.html (with props)
lucene/java/trunk/contrib/queryparser/src/test/
lucene/java/trunk/contrib/queryparser/src/test/org/
lucene/java/trunk/contrib/queryparser/src/test/org/apache/
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/messages/
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/messages/MessagesTestBundle.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/messages/MessagesTestBundle.properties (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/messages/MessagesTestBundle_ja.properties (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/messages/TestNLS.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/original/
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/original/TestMultiAnalyzerQPHelper.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/original/TestMultiAnalyzerWrapper.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/original/TestMultiFieldQPHelper.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/original/TestMultiFieldQueryParserWrapper.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/original/TestQPHelper.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/original/TestQueryParserWrapper.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/SpanOrQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/SpanTermQueryNodeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/SpansQueryConfigHandler.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/SpansQueryTreeBuilder.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/SpansValidatorQueryNodeProcessor.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/TestSpanQueryParser.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/TestSpanQueryParserSimpleSample.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/UniqueFieldAttribute.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/UniqueFieldAttributeImpl.java (with props)
lucene/java/trunk/contrib/queryparser/src/test/org/apache/lucene/queryParser/spans/UniqueFieldQueryNodeProcessor.java (with props)
Modified:
lucene/java/trunk/CHANGES.txt
lucene/java/trunk/build.xml
lucene/java/trunk/contrib/CHANGES.txt
lucene/java/trunk/src/java/org/apache/lucene/queryParser/CharStream.java
lucene/java/trunk/src/java/org/apache/lucene/queryParser/ComplexPhraseQueryParser.java
lucene/java/trunk/src/java/org/apache/lucene/queryParser/FastCharStream.java
lucene/java/trunk/src/java/org/apache/lucene/queryParser/MultiFieldQueryParser.java
lucene/java/trunk/src/java/org/apache/lucene/queryParser/ParseException.java
lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.java
lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParser.jj
lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserConstants.java
lucene/java/trunk/src/java/org/apache/lucene/queryParser/QueryParserTokenManager.java
lucene/java/trunk/src/java/org/apache/lucene/queryParser/Token.java
lucene/java/trunk/src/java/org/apache/lucene/queryParser/TokenMgrError.java
lucene/java/trunk/src/java/org/apache/lucene/queryParser/package.html
Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/CHANGES.txt?rev=800191&r1=800190&r2=800191&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Mon Aug 3 03:38:44 2009
@@ -359,6 +359,11 @@
34. LUCENE-1460: Changed TokenStreams/TokenFilters in contrib to
use the new TokenStream API. (Robert Muir, Michael Busch)
+35. LUCENE-1567: Deprecated Queryparser, which will be replaced by a
+ new QueryParser framework in Lucene 3.0, that is currently located
+ in contrib. (see New Features 35.)
+ (Luis Alves and Adriano Campos via Michael Busch)
+
Bug fixes
1. LUCENE-1415: MultiPhraseQuery has incorrect hashCode() and equals()
@@ -641,7 +646,14 @@
operations. This is currently used to fix offset problems when
multiple fields with the same name are added to a document.
(Mike McCandless, Mark Miller, Michael Busch)
-
+
+35. LUCENE-1567: Added a new QueryParser framework to contrib, that
+ allows implementing a new query syntax in a flexible and efficient
+ way. This new QueryParser will be moved to Lucene's core in release
+ 3.0 and will then replace the current core QueryParser, which
+ has been deprecated with this patch.
+ (Luis Alves and Adriano Campos via Michael Busch)
+
Optimizations
1. LUCENE-1427: Fixed QueryWrapperFilter to not waste time computing
Modified: lucene/java/trunk/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/build.xml?rev=800191&r1=800190&r2=800191&view=diff
==============================================================================
--- lucene/java/trunk/build.xml (original)
+++ lucene/java/trunk/build.xml Mon Aug 3 03:38:44 2009
@@ -330,6 +330,7 @@
<packageset dir="contrib/wikipedia/src/java"/>
<packageset dir="contrib/wordnet/src/java"/>
<packageset dir="contrib/xml-query-parser/src/java"/>
+ <packageset dir="contrib/queryparser/src/java"/>
<!-- end alpha sort -->
<!-- If the main javadoc Group listing includes an "Other -->
@@ -352,6 +353,7 @@
<group title="contrib: Memory" packages="org.apache.lucene.index.memory*"/>
<group title="contrib: Miscellaneous " packages="org.apache.lucene.misc*:org.apache.lucene.queryParser.analyzing*:org.apache.lucene.queryParser.precedence*"/>
<group title="contrib: Queries" packages="org.apache.lucene.search.similar*"/>
+ <group title="contrib: Query Parser" packages="org.apache.lucene.queryParser*"/>
<group title="contrib: RegEx" packages="org.apache.lucene.search.regex*:org.apache.regexp*"/>
<group title="contrib: Snowball" packages="org.apache.lucene.analysis.snowball*:net.sf.snowball*"/>
<group title="contrib: Spatial" packages="org.apache.lucene.spatial*"/>
@@ -361,7 +363,7 @@
<group title="contrib: Wikipedia" packages="org.apache.lucene.wikipedia*"/>
<group title="contrib: WordNet" packages="org.apache.lucene.wordnet*"/>
<group title="contrib: XML Query Parser" packages="org.apache.lucene.xmlparser*"/>
-
+
</sources>
</invoke-javadoc>
</sequential>
Modified: lucene/java/trunk/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/CHANGES.txt?rev=800191&r1=800190&r2=800191&view=diff
==============================================================================
--- lucene/java/trunk/contrib/CHANGES.txt (original)
+++ lucene/java/trunk/contrib/CHANGES.txt Mon Aug 3 03:38:44 2009
@@ -100,6 +100,13 @@
and fine tune how regular expressions are compiled and
matched. (Marc Zampetti zampettim@aim.com via Mike McCandless)
+12. LUCENE-1567: Added a new QueryParser framework, that allows
+ implementing a new query syntax in a flexible and efficient way.
+ This new QueryParser will be moved to Lucene's core in release
+ 3.0 and will then replace the current core QueryParser, which
+ has been deprecated with this patch.
+ (Luis Alves and Adriano Campos via Michael Busch)
+
Optimizations
1. LUCENE-1643: Re-use the collation key (RawCollationKey) for
Added: lucene/java/trunk/contrib/queryparser/build.xml
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/build.xml?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/build.xml (added)
+++ lucene/java/trunk/contrib/queryparser/build.xml Mon Aug 3 03:38:44 2009
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<project name="queryparser" default="default">
+
+ <description>
+ Flexible Query Parser
+ </description>
+
+ <property name="javac.source" value="1.5" />
+ <property name="javac.target" value="1.5" />
+
+ <import file="../contrib-build.xml"/>
+
+</project>
Propchange: lucene/java/trunk/contrib/queryparser/build.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/pom.xml.template
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/pom.xml.template?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/pom.xml.template (added)
+++ lucene/java/trunk/contrib/queryparser/pom.xml.template Mon Aug 3 03:38:44 2009
@@ -0,0 +1,40 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-contrib</artifactId>
+ <version>@version@</version>
+ </parent>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-queryparser</artifactId>
+ <name>Lucene Query Parser</name>
+ <version>@version@</version>
+ <description>
+ This is the Flexible Query Parser for apache lucene java
+ </description>
+ <packaging>jar</packaging>
+ <dependencies>
+ </dependencies>
+</project>
Propchange: lucene/java/trunk/contrib/queryparser/pom.xml.template
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/Message.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/Message.java?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/Message.java (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/Message.java Mon Aug 3 03:38:44 2009
@@ -0,0 +1,37 @@
+package org.apache.lucene.messages;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+import java.util.Locale;
+
+/**
+ * Message Interface for a lazy loading.
+ * For Native Language Support (NLS), system of software internationalization.
+ */
+public interface Message extends Serializable {
+
+ public String getKey();
+
+ public Object[] getArguments();
+
+ public String getLocalizedMessage();
+
+ public String getLocalizedMessage(Locale locale);
+
+}
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/Message.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/MessageImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/MessageImpl.java?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/MessageImpl.java (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/MessageImpl.java Mon Aug 3 03:38:44 2009
@@ -0,0 +1,71 @@
+package org.apache.lucene.messages;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Locale;
+
+/**
+ * Default implementation of Message interface.
+ * For Native Language Support (NLS), system of software internationalization.
+ */
+public class MessageImpl implements Message {
+
+ private static final long serialVersionUID = -3077643314630884523L;
+
+ private String key;
+
+ private Object[] arguments = new Object[0];
+
+ public MessageImpl(String key) {
+ this.key = key;
+
+ }
+
+ public MessageImpl(String key, Object... args) {
+ this(key);
+ this.arguments = args;
+ }
+
+ public Object[] getArguments() {
+ return this.arguments;
+ }
+
+ public String getKey() {
+ return this.key;
+ }
+
+ public String getLocalizedMessage() {
+ return getLocalizedMessage(Locale.getDefault());
+ }
+
+ public String getLocalizedMessage(Locale locale) {
+ return NLS.getLocalizedMessage(getKey(), locale, getArguments());
+ }
+
+ public String toString() {
+ Object[] args = getArguments();
+ String argsString = "";
+ if (args != null) {
+ for (int i = 0; i < args.length; i++) {
+ argsString += args[i] + (i < args.length ? "" : ", ");
+ }
+ }
+ return getKey() + " " + argsString;
+ }
+
+}
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/MessageImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLS.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLS.java?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLS.java (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLS.java Mon Aug 3 03:38:44 2009
@@ -0,0 +1,209 @@
+package org.apache.lucene.messages;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.MessageFormat;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * MessageBundles classes extend this class, to implement a bundle.
+ *
+ * For Native Language Support (NLS), system of software internationalization.
+ *
+ * This interface is similar to the NLS class in eclipse.osgi.util.NLS class -
+ * initializeMessages() method resets the values of all static strings, should
+ * only be called by classes that extend from NLS (see TestMessages.java for
+ * reference) - performs validation of all message in a bundle, at class load
+ * time - performs per message validation at runtime - see NLSTest.java for
+ * usage reference
+ *
+ * MessageBundle classes may subclass this type.
+ */
+public class NLS {
+
+ private static Map<String, Class<Object>> bundles = new HashMap<String, Class<Object>>(
+ 0);
+
+ protected NLS() {
+ // Do not instantiate
+ }
+
+ public static String getLocalizedMessage(String key) {
+ return getLocalizedMessage(key, Locale.getDefault());
+ }
+
+ public static String getLocalizedMessage(String key, Locale locale) {
+ Object message = getResourceBundleObject(key, locale);
+ if (message == null) {
+ return "Message with key:" + key + " and locale: " + locale
+ + " not found.";
+ }
+ return message.toString();
+ }
+
+ public static String getLocalizedMessage(String key, Locale locale,
+ Object... args) {
+ String str = getLocalizedMessage(key, locale);
+
+ if (args.length > 0) {
+ str = MessageFormat.format(str, args);
+ }
+
+ return str;
+ }
+
+ public static String getLocalizedMessage(String key, Object... args) {
+ return getLocalizedMessage(key, Locale.getDefault(), args);
+ }
+
+ /**
+ * Initialize a given class with the message bundle Keys Should be called from
+ * a class that extends NLS in a static block at class load time.
+ *
+ * @param bundleName
+ * Property file with that contains the message bundle
+ * @param clazz
+ * where constants will reside
+ */
+ @SuppressWarnings("unchecked")
+ protected static void initializeMessages(String bundleName, Class clazz) {
+ try {
+ load(clazz);
+ if (!bundles.containsKey(bundleName))
+ bundles.put(bundleName, clazz);
+ } catch (Throwable e) {
+ // ignore all errors and exceptions
+ // because this function is supposed to be called at class load time.
+ }
+ }
+
+ private static Object getResourceBundleObject(String messageKey, Locale locale) {
+
+ // slow resource checking
+ // need to loop thru all registered resource bundles
+ for (Iterator<String> it = bundles.keySet().iterator(); it.hasNext();) {
+ Class<Object> clazz = bundles.get(it.next());
+ ResourceBundle resourceBundle = ResourceBundle.getBundle(clazz.getName(),
+ locale);
+ if (resourceBundle != null) {
+ try {
+ Object obj = resourceBundle.getObject(messageKey);
+ if (obj != null)
+ return obj;
+ } catch (MissingResourceException e) {
+ // just continue it might be on the next resource bundle
+ }
+ }
+ }
+ // if resource is not found
+ return null;
+ }
+
+ /**
+ * @param bundleName
+ * @param clazz
+ */
+ private static void load(Class<Object> clazz) {
+ final Field[] fieldArray = clazz.getDeclaredFields();
+
+ boolean isFieldAccessible = (clazz.getModifiers() & Modifier.PUBLIC) != 0;
+
+ // build a map of field names to Field objects
+ final int len = fieldArray.length;
+ Map<String, Field> fields = new HashMap<String, Field>(len * 2);
+ for (int i = 0; i < len; i++) {
+ fields.put(fieldArray[i].getName(), fieldArray[i]);
+ loadfieldValue(fieldArray[i], isFieldAccessible, clazz);
+ }
+ }
+
+ /**
+ * @param field
+ * @param isFieldAccessible
+ */
+ private static void loadfieldValue(Field field, boolean isFieldAccessible,
+ Class<Object> clazz) {
+ int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC;
+ int MOD_MASK = MOD_EXPECTED | Modifier.FINAL;
+ if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED)
+ return;
+
+ // Set a value for this empty field.
+ if (!isFieldAccessible)
+ makeAccessible(field);
+ try {
+ field.set(null, field.getName());
+ validateMessage(field.getName(), clazz);
+ } catch (IllegalArgumentException e) {
+ // should not happen
+ } catch (IllegalAccessException e) {
+ // should not happen
+ }
+ }
+
+ /**
+ * @param key
+ * - Message Key
+ */
+ private static void validateMessage(String key, Class<Object> clazz) {
+ // Test if the message is present in the resource bundle
+ try {
+ ResourceBundle resourceBundle = ResourceBundle.getBundle(clazz.getName(),
+ Locale.getDefault());
+ if (resourceBundle != null) {
+ Object obj = resourceBundle.getObject(key);
+ if (obj == null)
+ System.err.println("WARN: Message with key:" + key + " and locale: "
+ + Locale.getDefault() + " not found.");
+ }
+ } catch (MissingResourceException e) {
+ System.err.println("WARN: Message with key:" + key + " and locale: "
+ + Locale.getDefault() + " not found.");
+ } catch (Throwable e) {
+ // ignore all other errors and exceptions
+ // since this code is just a test to see if the message is present on the
+ // system
+ }
+ }
+
+ /*
+ * Make a class field accessible
+ */
+ @SuppressWarnings("unchecked")
+ private static void makeAccessible(final Field field) {
+ if (System.getSecurityManager() == null) {
+ field.setAccessible(true);
+ } else {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ field.setAccessible(true);
+ return null;
+ }
+ });
+ }
+ }
+}
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLS.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLSException.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLSException.java?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLSException.java (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLSException.java Mon Aug 3 03:38:44 2009
@@ -0,0 +1,34 @@
+package org.apache.lucene.messages;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Interface that exceptions should implement to support lazy loading of messages.
+ *
+ * For Native Language Support (NLS), system of software internationalization.
+ *
+ * This Interface should be implemented by all exceptions that require
+ * translation
+ *
+ */
+public interface NLSException {
+ /**
+ * @return a instance of a class that implements the Message interface
+ */
+ public Message getMessageObject();
+}
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/NLSException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/package.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/package.html?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/package.html (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/package.html Mon Aug 3 03:38:44 2009
@@ -0,0 +1,99 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body>
+
+For Native Language Support (NLS), system of software internationalization.
+
+<h2>NLS message API</h2>
+<p>
+This utility API, adds support for NLS messages in the apache code.
+It is currently used by the lucene "New Flexible Query PArser".
+</p>
+<p>
+Features:
+ <ol>
+ <li>Message reference in the code, using static Strings</li>
+ <li>Message resource validation at class load time, for easier debugging</li>
+ <li>Allows for message IDs to be re-factored using eclipse or other code re-factor tools</li>
+ <li>Allows for reference count on messages, just like code</li>
+ <li>Lazy loading of Message Strings</li>
+ <li>Normal loading Message Strings</li>
+ </ol>
+</p>
+
+<br/>
+<br/>
+<p>
+Lazy loading of Message Strings
+
+<pre>
+ public class MessagesTestBundle extends NLS {
+
+ private static final String BUNDLE_NAME = MessagesTestBundle.class.getName();
+
+ private MessagesTestBundle() {
+ // should never be instantiated
+ }
+
+ static {
+ // register all string ids with NLS class and initialize static string
+ // values
+ NLS.initializeMessages(BUNDLE_NAME, MessagesTestBundle.class);
+ }
+
+ // static string must match the strings in the property files.
+ public static String Q0001E_INVALID_SYNTAX;
+ public static String Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION;
+
+ // this message is missing from the properties file
+ public static String Q0005E_MESSAGE_NOT_IN_BUNDLE;
+ }
+
+ // Create a message reference
+ Message invalidSyntax = new MessageImpl(MessagesTestBundle.Q0001E_INVALID_SYNTAX, "XXX");
+
+ // Do other stuff in the code...
+ // when is time to display the message to the user or log the message on a file
+ // the message is loaded from the correct bundle
+
+ String message1 = invalidSyntax.getLocalizedMessage();
+ String message2 = invalidSyntax.getLocalizedMessage(Locale.JAPANESE);
+</pre>
+</p>
+
+<br/>
+<br/>
+<p>
+Normal loading of Message Strings
+
+<pre>
+ String message1 = NLS.getLocalizedMessage(MessagesTestBundle.Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION);
+ String message2 = NLS.getLocalizedMessage(MessagesTestBundle.Q0004E_INVALID_SYNTAX_ESCAPE_UNICODE_TRUNCATION, Locale.JAPANESE);
+</pre>
+</p>
+
+<p>
+The org.apache.lucene.messages.TestNLS junit contains several other examples.
+The TestNLS java code is available from the Apache Lucene code repository.
+</p>
+</body>
+</html>
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/messages/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeError.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeError.java?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeError.java (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeError.java Mon Aug 3 03:38:44 2009
@@ -0,0 +1,75 @@
+package org.apache.lucene.queryParser.core;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.lucene.messages.Message;
+import org.apache.lucene.messages.NLSException;
+
+/**
+ * Error class with NLS support
+ *
+ * @see org.apache.lucene.messages.NLS
+ * @see org.apache.lucene.messages.Message
+ */
+public class QueryNodeError extends Error implements NLSException {
+
+ private static final long serialVersionUID = 1804855832182710327L;
+ private Message message;
+
+ /**
+ * @param message
+ * - NLS Message Object
+ */
+ public QueryNodeError(Message message) {
+ super(message.getKey());
+
+ this.message = message;
+
+ }
+
+ /**
+ * @param throwable
+ * - @see java.lang.Error
+ */
+ public QueryNodeError(Throwable throwable) {
+ super(throwable);
+ }
+
+ /**
+ * @param message
+ * - NLS Message Object
+ * @param throwable
+ * - @see java.lang.Error
+ */
+ public QueryNodeError(Message message, Throwable throwable) {
+ super(message.getKey(), throwable);
+
+ this.message = message;
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.lucene.messages.NLSException#getMessageObject()
+ */
+ public Message getMessageObject() {
+ return this.message;
+ }
+
+}
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeError.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeException.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeException.java?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeException.java (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeException.java Mon Aug 3 03:38:44 2009
@@ -0,0 +1,87 @@
+package org.apache.lucene.queryParser.core;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Locale;
+
+import org.apache.lucene.messages.Message;
+import org.apache.lucene.messages.MessageImpl;
+import org.apache.lucene.messages.NLS;
+import org.apache.lucene.messages.NLSException;
+import org.apache.lucene.queryParser.core.messages.QueryParserMessages;
+import org.apache.lucene.queryParser.core.nodes.QueryNode;
+
+/**
+ * <p>
+ * This exception should be thrown if something wrong happens when dealing with
+ * {@link QueryNode}s.
+ * </p>
+ * <p>
+ * It also supports NLS messages.
+ * </p>
+ *
+ * @see Message
+ * @see NLS
+ * @see NLSException
+ * @see QueryNode
+ */
+public class QueryNodeException extends Exception implements NLSException {
+
+ private static final long serialVersionUID = -5962648855261624214L;
+
+ protected Message message = new MessageImpl(QueryParserMessages.EMPTY_MESSAGE);
+
+ public QueryNodeException(Message message) {
+ super(message.getKey());
+
+ this.message = message;
+
+ }
+
+ public QueryNodeException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public QueryNodeException(Message message, Throwable throwable) {
+ super(message.getKey(), throwable);
+
+ this.message = message;
+
+ }
+
+ public Message getMessageObject() {
+ return this.message;
+ }
+
+ public String getMessage() {
+ return getLocalizedMessage();
+ }
+
+ public String getLocalizedMessage() {
+ return getLocalizedMessage(Locale.getDefault());
+ }
+
+ public String getLocalizedMessage(Locale locale) {
+ return this.message.getLocalizedMessage(locale);
+ }
+
+ public String toString() {
+ return this.message.getKey() + ": " + getLocalizedMessage();
+ }
+
+}
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java Mon Aug 3 03:38:44 2009
@@ -0,0 +1,121 @@
+package org.apache.lucene.queryParser.core;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.lucene.messages.Message;
+import org.apache.lucene.messages.MessageImpl;
+import org.apache.lucene.queryParser.core.messages.QueryParserMessages;
+import org.apache.lucene.queryParser.core.nodes.QueryNode;
+import org.apache.lucene.queryParser.core.parser.SyntaxParser;
+
+/**
+ * This should be thrown when an exception happens during the query parsing from
+ * string to the query node tree.
+ *
+ * @see QueryNodeException
+ * @see SyntaxParser
+ * @see QueryNode
+ */
+public class QueryNodeParseException extends QueryNodeException {
+
+ private static final long serialVersionUID = 8197535103538766773L;
+
+ private CharSequence query;
+
+ private int beginColumn = -1;
+
+ private int beginLine = -1;
+
+ private String errorToken = "";
+
+ public QueryNodeParseException(Message message) {
+ super(message);
+ }
+
+ public QueryNodeParseException(Throwable throwable) {
+ super(throwable);
+ }
+
+ public QueryNodeParseException(Message message, Throwable throwable) {
+ super(message, throwable);
+ }
+
+ public void setQuery(CharSequence query) {
+ this.query = query;
+ this.message = new MessageImpl(
+ QueryParserMessages.INVALID_SYNTAX_CANNOT_PARSE, query, "");
+ }
+
+ public CharSequence getQuery() {
+ return this.query;
+ }
+
+ /**
+ * @param errorToken
+ * the errorToken in the query
+ */
+ protected void setErrorToken(String errorToken) {
+ this.errorToken = errorToken;
+ }
+
+ public String getErrorToken() {
+ return this.errorToken;
+ }
+
+ public void setNonLocalizedMessage(Message message) {
+ this.message = message;
+ }
+
+ /**
+ * For EndOfLine and EndOfFile ("<EOF>") parsing problems the last char in the
+ * string is returned For the case where the parser is not able to figure out
+ * the line and column number -1 will be returned
+ *
+ * @return line where the problem was found
+ */
+ public int getBeginLine() {
+ return this.beginLine;
+ }
+
+ /**
+ * For EndOfLine and EndOfFile ("<EOF>") parsing problems the last char in the
+ * string is returned For the case where the parser is not able to figure out
+ * the line and column number -1 will be returned
+ *
+ * @return column of the first char where the problem was found
+ */
+ public int getBeginColumn() {
+ return this.beginColumn;
+ }
+
+ /**
+ * @param beginLine
+ * the beginLine to set
+ */
+ protected void setBeginLine(int beginLine) {
+ this.beginLine = beginLine;
+ }
+
+ /**
+ * @param beginColumn
+ * the beginColumn to set
+ */
+ protected void setBeginColumn(int beginColumn) {
+ this.beginColumn = beginColumn;
+ }
+}
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryParserHelper.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryParserHelper.java?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryParserHelper.java (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryParserHelper.java Mon Aug 3 03:38:44 2009
@@ -0,0 +1,261 @@
+package org.apache.lucene.queryParser.core;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.lucene.queryParser.core.builders.QueryBuilder;
+import org.apache.lucene.queryParser.core.config.QueryConfigHandler;
+import org.apache.lucene.queryParser.core.nodes.QueryNode;
+import org.apache.lucene.queryParser.core.parser.SyntaxParser;
+import org.apache.lucene.queryParser.core.processors.QueryNodeProcessor;
+
+/**
+ * <p>
+ * This class is a helper for the query parser framework, it does all the three
+ * query parser phrases at once: text parsing, query processing and query
+ * building.
+ * </p>
+ * <p>
+ * It contains methods that allows the user to change the implementation used on
+ * the three phases.
+ * </p>
+ *
+ * @see QueryNodeProcessor
+ * @see SyntaxParser
+ * @see QueryBuilder
+ * @see QueryConfigHandler
+ */
+public class QueryParserHelper {
+
+ private QueryNodeProcessor processor;
+
+ private SyntaxParser syntaxParser;
+
+ private QueryBuilder builder;
+
+ private QueryConfigHandler config;
+
+ /**
+ * Creates a query parser helper object using the specified configuration,
+ * text parser, processor and builder.
+ *
+ * @param queryConfigHandler
+ * the query configuration handler that will be initially set to this
+ * helper
+ * @param syntaxParser
+ * the text parser that will be initially set to this helper
+ * @param processor
+ * the query processor that will be initially set to this helper
+ * @param builder
+ * the query builder that will be initially set to this helper
+ *
+ * @see QueryNodeProcessor
+ * @see SyntaxParser
+ * @see QueryBuilder
+ * @see QueryConfigHandler
+ */
+ public QueryParserHelper(QueryConfigHandler queryConfigHandler, SyntaxParser syntaxParser, QueryNodeProcessor processor,
+ QueryBuilder builder) {
+ this.syntaxParser = syntaxParser;
+ this.config = queryConfigHandler;
+ this.processor = processor;
+ this.builder = builder;
+
+ if (processor != null) {
+ processor.setQueryConfigHandler(queryConfigHandler);
+ }
+
+ }
+
+ /**
+ * Returns the processor object used to process the query node tree, it
+ * returns <code>null</code> if no processor is used.
+ *
+ * @return the actual processor used to process the query node tree,
+ * <code>null</code> if no processor is used
+ *
+ * @see QueryNodeProcessor
+ * @see #setQueryNodeProcessor(QueryNodeProcessor)
+ */
+ public QueryNodeProcessor getQueryNodeProcessor() {
+ return processor;
+ }
+
+ /**
+ * Sets the processor that will be used to process the query node tree. If
+ * there is any {@link QueryConfigHandler} returned by
+ * {@link #getQueryConfigHandler()}, it will be set on the processor. The
+ * argument can be <code>null</code>, which means that no processor will be
+ * used to process the query node tree.
+ *
+ * @param processor
+ * the processor that will be used to process the query node tree,
+ * this argument can be <code>null</code>
+ *
+ * @see #getQueryNodeProcessor()
+ * @see QueryNodeProcessor
+ */
+ public void setQueryNodeProcessor(QueryNodeProcessor processor) {
+ this.processor = processor;
+ this.processor.setQueryConfigHandler(getQueryConfigHandler());
+
+ }
+
+ /**
+ * Sets the text parser that will be used to parse the query string, it cannot
+ * be <code>null</code>.
+ *
+ * @param syntaxParser
+ * the text parser that will be used to parse the query string
+ *
+ * @see #getTextParser()
+ * @see SyntaxParser
+ */
+ public void setSyntaxParser(SyntaxParser syntaxParser) {
+
+ if (syntaxParser == null) {
+ throw new IllegalArgumentException("textParser should not be null!");
+ }
+
+ this.syntaxParser = syntaxParser;
+
+ }
+
+ /**
+ * The query builder that will be used to build an object from the query node
+ * tree. It cannot be <code>null</code>.
+ *
+ * @param queryBuilder
+ * the query builder used to build something from the query node tree
+ *
+ * @see #getQueryBuilder()
+ * @see QueryBuilder
+ */
+ public void setQueryBuilder(QueryBuilder queryBuilder) {
+
+ if (queryBuilder == null) {
+ throw new IllegalArgumentException("queryBuilder should not be null!");
+ }
+
+ this.builder = queryBuilder;
+
+ }
+
+ /**
+ * Returns the query configuration handler, which is used during the query
+ * node tree processing. It can be <code>null</code>.
+ *
+ * @return the query configuration handler used on the query processing,
+ * <code>null</code> if not query configuration handler is defined
+ *
+ * @see QueryConfigHandler
+ * @see #setQueryConfigHandler(QueryConfigHandler)
+ */
+ public QueryConfigHandler getQueryConfigHandler() {
+ return config;
+ }
+
+ /**
+ * Returns the query builder used to build a object from the query node tree.
+ * The object produced by this builder is returned by
+ * {@link #parse(String, String)}.
+ *
+ * @return the query builder
+ *
+ * @see #setQueryBuilder(QueryBuilder)
+ * @see QueryBuilder
+ */
+ public QueryBuilder getQueryBuilder() {
+ return this.builder;
+ }
+
+ /**
+ * Returns the text parser used to build a query node tree from a query
+ * string. The default text parser instance returned by this method is a
+ * {@link SyntaxParser}.
+ *
+ * @return the text parse used to build query node trees.
+ *
+ * @see SyntaxParser
+ * @see #setSyntaxParser(SyntaxParser)
+ */
+ public SyntaxParser getTextParser() {
+ return this.syntaxParser;
+ }
+
+ /**
+ * Sets the query configuration handler that will be used during query
+ * processing. It can be <code>null</code>. It's also set to the processor
+ * returned by {@link #getQueryNodeProcessor()}.
+ *
+ * @param config
+ * the query configuration handler used during query processing, it
+ * can be <code>null</code>
+ *
+ * @see #getQueryConfigHandler()
+ * @see QueryConfigHandler
+ */
+ public void setQueryConfigHandler(QueryConfigHandler config) {
+ this.config = config;
+ QueryNodeProcessor processor = getQueryNodeProcessor();
+
+ if (processor != null) {
+ processor.setQueryConfigHandler(config);
+ }
+
+ }
+
+ /**
+ * Parses a query string to an object, usually some query object. <br/>
+ * <br/>
+ * In this method the three phases are executed: <br/>
+ * <br/>
+ * 1st - the query string is parsed using the
+ * text parser returned by {@link #getTextParser()}, the result is a query
+ * node tree <br/>
+ * <br/>
+ * 2nd - the query node tree is processed by the
+ * processor returned by {@link #getQueryNodeProcessor()} <br/>
+ * <br/>
+ * 3th - a object is built from the query node
+ * tree using the builder returned by {@link #getQueryBuilder()}
+ *
+ * @param query
+ * the query string
+ * @param defaultField
+ * the default field used by the text parser
+ *
+ * @return the object built from the query
+ *
+ * @throws QueryNodeException
+ * if something wrong happens along the three phases
+ */
+ public Object parse(String query, String defaultField)
+ throws QueryNodeException {
+ QueryNode queryTree = getTextParser().parse(query, defaultField);
+
+ QueryNodeProcessor processor = getQueryNodeProcessor();
+
+ if (processor != null) {
+ queryTree = processor.process(queryTree);
+ }
+
+ return getQueryBuilder().build(queryTree);
+
+ }
+
+}
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryParserHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryBuilder.java?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryBuilder.java (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryBuilder.java Mon Aug 3 03:38:44 2009
@@ -0,0 +1,43 @@
+package org.apache.lucene.queryParser.core.builders;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.lucene.queryParser.core.QueryNodeException;
+import org.apache.lucene.queryParser.core.nodes.QueryNode;
+
+/**
+ * This interface is used by implementors classes that builds some kind of
+ * object from a query tree.
+ *
+ * @see QueryTreeBuilder
+ */
+public interface QueryBuilder {
+
+ /**
+ * Builds some kind of object from a query tree.
+ *
+ * @param queryNode
+ * the query tree root node
+ *
+ * @return some object generated from the query tree
+ *
+ * @throws QueryNodeException
+ */
+ Object build(QueryNode queryNode) throws QueryNodeException;
+
+}
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java Mon Aug 3 03:38:44 2009
@@ -0,0 +1,222 @@
+package org.apache.lucene.queryParser.core.builders;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.lucene.messages.MessageImpl;
+import org.apache.lucene.queryParser.core.QueryNodeException;
+import org.apache.lucene.queryParser.core.messages.QueryParserMessages;
+import org.apache.lucene.queryParser.core.nodes.FieldableNode;
+import org.apache.lucene.queryParser.core.nodes.QueryNode;
+import org.apache.lucene.queryParser.original.parser.EscapeQuerySyntaxImpl;
+
+/**
+ * This class should be used when there is a builder for each type of node.
+ *
+ * The type of node may be defined in 2 different ways: - by the field name,
+ * when the node implements the {@link FieldableNode} interface - by its class,
+ * it keeps checking the class and all the interfaces and classes this class
+ * implements/extends until it finds a builder for that class/interface
+ *
+ * This class always check if there is a builder for the field name before it
+ * checks for the node class. So, field name builders have precedence over class
+ * builders.
+ *
+ * When a builder is found for a node, it's called and the node is passed to the
+ * builder. If the returned built object is not <code>null</code>, it's tagged
+ * on the node using the tag {@link QueryTreeBuilder#QUERY_TREE_BUILDER_TAGID}.
+ *
+ * The children are usually built before the parent node. However, if a builder
+ * associated to a node is an instance of {@link QueryTreeBuilder}, the node is
+ * delegated to this builder and it's responsible to build the node and its
+ * children.
+ *
+ * @see QueryBuilder
+ */
+public class QueryTreeBuilder implements QueryBuilder {
+
+ /**
+ * This tag is used to tag the nodes in a query tree with the built objects
+ * produced from their own associated builder.
+ */
+ public static final String QUERY_TREE_BUILDER_TAGID = QueryTreeBuilder.class
+ .getName();
+
+ private HashMap<Class<? extends QueryNode>, QueryBuilder> queryNodeBuilders;
+
+ private HashMap<CharSequence, QueryBuilder> fieldNameBuilders;
+
+ /**
+ * {@link QueryTreeBuilder} constructor.
+ */
+ public QueryTreeBuilder() {
+ // empty constructor
+ }
+
+ /**
+ * Associates a field name with a builder.
+ *
+ * @param fieldName
+ * the field name
+ * @param builder
+ * the builder to be associated
+ */
+ public void setBuilder(CharSequence fieldName, QueryBuilder builder) {
+
+ if (this.fieldNameBuilders == null) {
+ this.fieldNameBuilders = new HashMap<CharSequence, QueryBuilder>();
+ }
+
+ this.fieldNameBuilders.put(fieldName, builder);
+
+ }
+
+ /**
+ * Associates a class with a builder
+ *
+ * @param queryNodeClass
+ * the class
+ * @param builder
+ * the builder to be associated
+ */
+ public void setBuilder(Class<? extends QueryNode> queryNodeClass,
+ QueryBuilder builder) {
+
+ if (this.queryNodeBuilders == null) {
+ this.queryNodeBuilders = new HashMap<Class<? extends QueryNode>, QueryBuilder>();
+ }
+
+ this.queryNodeBuilders.put(queryNodeClass, builder);
+
+ }
+
+ private void process(QueryNode node) throws QueryNodeException {
+
+ if (node != null) {
+ QueryBuilder builder = getBuilder(node);
+
+ if (!(builder instanceof QueryTreeBuilder)) {
+ List<QueryNode> children = node.getChildren();
+
+ if (children != null) {
+
+ for (QueryNode child : children) {
+ process(child);
+ }
+
+ }
+
+ }
+
+ processNode(node, builder);
+
+ }
+
+ }
+
+ private QueryBuilder getBuilder(QueryNode node) {
+ QueryBuilder builder = null;
+
+ if (this.fieldNameBuilders != null && node instanceof FieldableNode) {
+
+ builder = this.fieldNameBuilders.get(((FieldableNode) node).getField());
+
+ }
+
+ if (builder == null && this.queryNodeBuilders != null) {
+
+ Class<?> clazz = node.getClass();
+
+ do {
+ builder = getQueryBuilder(clazz);
+
+ if (builder == null) {
+ Class<?>[] classes = node.getClass().getInterfaces();
+
+ for (Class<?> actualClass : classes) {
+ builder = getQueryBuilder(actualClass);
+
+ if (builder != null) {
+ break;
+ }
+
+ }
+
+ }
+
+ } while (builder == null && (clazz = clazz.getSuperclass()) != null);
+
+ }
+
+ return builder;
+
+ }
+
+ private void processNode(QueryNode node, QueryBuilder builder)
+ throws QueryNodeException {
+
+ if (builder == null) {
+
+ throw new QueryNodeException(new MessageImpl(
+ QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, node
+ .toQueryString(new EscapeQuerySyntaxImpl()), node.getClass()
+ .getName()));
+
+ }
+
+ Object obj = builder.build(node);
+
+ if (obj != null) {
+ node.setTag(QUERY_TREE_BUILDER_TAGID, obj);
+ }
+
+ }
+
+ private QueryBuilder getQueryBuilder(Class<?> clazz) {
+
+ if (QueryNode.class.isAssignableFrom(clazz)) {
+ return this.queryNodeBuilders.get(clazz);
+ }
+
+ return null;
+
+ }
+
+ /**
+ * Builds some kind of object from a query tree. Each node in the query tree
+ * is built using an specific builder associated to it.
+ *
+ * @param queryNode
+ * the query tree root node
+ *
+ * @return the built object
+ *
+ * @throws QueryNodeException
+ * if some node builder throws a {@link QueryNodeException} or if
+ * there is a node which had no builder associated to it
+ */
+ public Object build(QueryNode queryNode) throws QueryNodeException {
+ process(queryNode);
+
+ return queryNode.getTag(QUERY_TREE_BUILDER_TAGID);
+
+ }
+
+}
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/QueryTreeBuilder.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/package.html
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/package.html?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/package.html (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/package.html Mon Aug 3 03:38:44 2009
@@ -0,0 +1,39 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+<body>
+
+Contains the necessary classes to implement query builders
+
+<h2>Query Parser Builders</h2>
+<p>
+The package <tt>org.apache.lucene.queryParser.builders</tt> contains the interface that
+builders must implement, it also contain a utility {@link org.apache.lucene.queryParser.core.builders.QueryTreeBuilder}, which walks the tree
+and call the Builder for each node in the tree.
+Builder normally convert QueryNode Object into a Lucene Query Object,
+and normally it's a one-to-one mapping class.
+
+But other builders implementations can by written to convert QueryNode objects to other non lucene objects.
+</p>
+<p>
+</p>
+</body>
+</html>
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/builders/package.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/FieldConfig.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/FieldConfig.java?rev=800191&view=auto
==============================================================================
--- lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/FieldConfig.java (added)
+++ lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/FieldConfig.java Mon Aug 3 03:38:44 2009
@@ -0,0 +1,64 @@
+package org.apache.lucene.queryParser.core.config;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.apache.lucene.util.AttributeSource;
+
+/**
+ * This class represents a field configuration. Every configuration should be
+ * set using the methods inherited from {@link AttributeSource}.
+ *
+ * @see QueryConfigHandler
+ * @see org.apache.lucene.util.Attribute
+ */
+public class FieldConfig extends AttributeSource {
+
+ private CharSequence fieldName;
+
+ /**
+ * Constructs a {@link FieldConfig}
+ *
+ * @param fieldName
+ * the field name, it cannot be null
+ * @throws IllegalArgumentException
+ * if the field name is null
+ */
+ public FieldConfig(CharSequence fieldName) {
+
+ if (fieldName == null) {
+ throw new IllegalArgumentException("field name should not be null!");
+ }
+
+ this.fieldName = fieldName;
+
+ }
+
+ /**
+ * Returns the field name this configuration represents.
+ *
+ * @return the field name
+ */
+ public CharSequence getFieldName() {
+ return this.fieldName;
+ }
+
+ public String toString(){
+ return "<fieldconfig name=\"" + this.fieldName + "\" attributes=\"" + super.toString() + "\"/>";
+ }
+
+}
Propchange: lucene/java/trunk/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/config/FieldConfig.java
------------------------------------------------------------------------------
svn:eol-style = native