public virtual Query Build(IQueryNode queryNode) { BooleanQueryNode booleanNode = (BooleanQueryNode)queryNode; BooleanQuery bQuery = new BooleanQuery(); IList <IQueryNode> children = booleanNode.GetChildren(); if (children != null) { foreach (IQueryNode child in children) { object obj = child.GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID); if (obj != null) { Query query = (Query)obj; try { bQuery.Add(query, GetModifierValue(child)); } catch (BooleanQuery.TooManyClausesException ex) { throw new QueryNodeException(new Message( QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery .MaxClauseCount, queryNode .ToQueryString(new EscapeQuerySyntax())), ex); } } } } return(bQuery); }
public virtual Query Build(IQueryNode queryNode) { BooleanQueryNode booleanNode = (BooleanQueryNode)queryNode; BooleanQuery bQuery = new BooleanQuery(); IList <IQueryNode> children = booleanNode.GetChildren(); if (children != null) { foreach (IQueryNode child in children) { object obj = child.GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID); if (obj != null) { Query query = (Query)obj; try { bQuery.Add(query, GetModifierValue(child)); } catch (BooleanQuery.TooManyClausesException ex) { // LUCENENET: Factored out NLS/Message/IMessage so end users can optionally utilize the built-in .NET localization. throw new QueryNodeException(string.Format( QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery .MaxClauseCount, queryNode .ToQueryString(new EscapeQuerySyntax())), ex); } } } } return(bQuery); }
public virtual Query Build(IQueryNode queryNode) { StandardBooleanQueryNode booleanNode = (StandardBooleanQueryNode)queryNode; BooleanQuery bQuery = new BooleanQuery(booleanNode.DisableCoord); IList<IQueryNode> children = booleanNode.GetChildren(); if (children != null) { foreach (IQueryNode child in children) { object obj = child.GetTag(QueryTreeBuilder.QUERY_TREE_BUILDER_TAGID); if (obj != null) { Query query = (Query)obj; try { bQuery.Add(query, GetModifierValue(child)); } catch (BooleanQuery.TooManyClauses ex) { throw new QueryNodeException(new MessageImpl( QueryParserMessages.TOO_MANY_BOOLEAN_CLAUSES, BooleanQuery .MaxClauseCount, queryNode .ToQueryString(new EscapeQuerySyntaxImpl())), ex); } } } } return bQuery; }
protected override IQueryNode PostProcessNode(IQueryNode node) { if (node is WildcardQueryNode) { WildcardQueryNode wildcardNode = (WildcardQueryNode)node; if (wildcardNode.Text.Length > 0) { // Validate if the wildcard was escaped if (UnescapedCharSequence.WasEscaped(wildcardNode.Text, 0)) return node; switch (wildcardNode.Text[0]) { case '*': case '?': throw new QueryNodeException(new MessageImpl( QueryParserMessages.LEADING_WILDCARD_NOT_ALLOWED, node .ToQueryString(new EscapeQuerySyntaxImpl()))); } } } return node; }
public virtual Query Build(IQueryNode queryNode) { // validates node if (!(queryNode is MatchAllDocsQueryNode)) { throw new QueryNodeException(new MessageImpl( QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, queryNode .ToQueryString(new EscapeQuerySyntaxImpl()), queryNode.GetType() .Name)); } return new MatchAllDocsQuery(); }
protected override IQueryNode PostProcessNode(IQueryNode node) { if (node is WildcardQueryNode) { WildcardQueryNode wildcardNode = (WildcardQueryNode)node; if (wildcardNode.Text.Length > 0) { // Validate if the wildcard was escaped if (UnescapedCharSequence.WasEscaped(wildcardNode.Text, 0)) { return(node); } switch (wildcardNode.Text[0]) { case '*': case '?': throw new QueryNodeException(new Message( QueryParserMessages.LEADING_WILDCARD_NOT_ALLOWED, node .ToQueryString(new EscapeQuerySyntax()))); } } } return(node); }
private void ProcessNode(IQueryNode node, IQueryBuilder <TQuery> builder) { if (builder == null) { throw new QueryNodeException(new Message( QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, node .ToQueryString(new EscapeQuerySyntax()), node.GetType() .Name)); } object obj = builder.Build(node); if (obj != null) { node.SetTag(QUERY_TREE_BUILDER_TAGID, obj); } }
public virtual Query Build(IQueryNode queryNode) { // validates node if (!(queryNode is MatchAllDocsQueryNode)) { throw new QueryNodeException(new MessageImpl( QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, queryNode .ToQueryString(new EscapeQuerySyntaxImpl()), queryNode.GetType() .Name)); } return(new MatchAllDocsQuery()); }
private static void ProcessNode(IQueryNode node, IQueryBuilder <TQuery> builder) // LUCENENET: CA1822: Mark members as static { if (builder == null) { // LUCENENET: Factored out NLS/Message/IMessage so end users can optionally utilize the built-in .NET localization. throw new QueryNodeException(string.Format( QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, node .ToQueryString(new EscapeQuerySyntax()), node.GetType() .Name)); } object obj = builder.Build(node); if (obj != null) { node.SetTag(QUERY_TREE_BUILDER_TAGID, obj); } }
protected override IQueryNode PostProcessNode(IQueryNode node) { if (node is WildcardQueryNode wildcardNode) { if (wildcardNode.Text.Length > 0) { // Validate if the wildcard was escaped if (UnescapedCharSequence.WasEscaped(wildcardNode.Text, 0)) { return(node); } switch (wildcardNode.Text[0]) { case '*': case '?': // LUCENENET: Factored out NLS/Message/IMessage so end users can optionally utilize the built-in .NET localization. throw new QueryNodeException(string.Format( QueryParserMessages.LEADING_WILDCARD_NOT_ALLOWED, node .ToQueryString(new EscapeQuerySyntax()))); } } } return(node); }
public virtual Query Build(IQueryNode queryNode) { // validates node if (!(queryNode is MatchNoDocsQueryNode)) { // LUCENENET: Factored out NLS/Message/IMessage so end users can optionally utilize the built-in .NET localization. throw new QueryNodeException(string.Format( QueryParserMessages.LUCENE_QUERY_CONVERSION_ERROR, queryNode .ToQueryString(new EscapeQuerySyntax()), queryNode.GetType() .Name)); } return(new BooleanQuery()); }