protected override IQueryNode PreProcessNode(IQueryNode node) { if (!((node is BooleanQueryNode && !(node is AndQueryNode)) || node .GetType() == typeof(FieldQueryNode))) { throw new QueryNodeException(new MessageImpl( QueryParserMessages.NODE_ACTION_NOT_SUPPORTED)); } return(node); }
protected override IQueryNode PreProcessNode(IQueryNode node) { if (!((node is BooleanQueryNode && !(node is AndQueryNode)) || node .GetType() == typeof(FieldQueryNode))) { throw new QueryNodeException(new MessageImpl( QueryParserMessages.NODE_ACTION_NOT_SUPPORTED)); } return node; }
protected override IQueryNode PreProcessNode(IQueryNode node) { if (!((node is BooleanQueryNode && !(node is AndQueryNode)) || node .GetType() == typeof(FieldQueryNode))) { // LUCENENET: Factored out NLS/Message/IMessage so end users can optionally utilize the built-in .NET localization. throw new QueryNodeException( QueryParserMessages.NODE_ACTION_NOT_SUPPORTED); } 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 virtual string TranslateBody(IQueryNode node) { var type = node.GetType(); if (type == typeof(BinaryNode)) { return TranslateBinaryNode((BinaryNode)node); } else if (type == typeof(MemberNode)) { return TranslateMemberNode((MemberNode)node); } else if (type == typeof(ConstantNode)) { return TranslateConstantNode((ConstantNode)node); } else if (type == typeof(MethodNode)) { return TranslateSubMethod((MethodNode)node); } throw new NotSupportedException($"'{type}' is not supported"); }
private IQueryBuilder <TQuery> GetBuilder(IQueryNode node) { IQueryBuilder <TQuery> builder = null; if (this.fieldNameBuilders != null && node is IFieldableNode) { string field = ((IFieldableNode)node).Field; this.fieldNameBuilders.TryGetValue(field, out builder); } if (builder == null && this.queryNodeBuilders != null) { Type clazz = node.GetType(); do { builder = GetQueryBuilder(clazz); if (builder == null) { Type[] classes = clazz.GetInterfaces(); foreach (Type actualClass in classes) { builder = GetQueryBuilder(actualClass); if (builder != null) { break; } } } } while (builder == null && (clazz = clazz.GetTypeInfo().BaseType) != null); } return(builder); }
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); } }
protected virtual bool IsDefaultBooleanQueryNode(IQueryNode toTest) { return(toTest != null && typeof(BooleanQueryNode).Equals(toTest.GetType())); }
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); } }
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()); }
protected virtual bool IsDefaultBooleanQueryNode(IQueryNode toTest) { return toTest != null && typeof(BooleanQueryNode).Equals(toTest.GetType()); }