//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.apache.lucene.search.Query toLuceneQuery(org.neo4j.internal.kernel.api.IndexQuery... predicates) throws org.neo4j.internal.kernel.api.exceptions.schema.IndexNotApplicableKernelException private Query ToLuceneQuery(params IndexQuery[] predicates) { IndexQuery predicate = predicates[0]; switch (predicate.Type()) { case exact: Value[] values = new Value[predicates.Length]; for (int i = 0; i < predicates.Length; i++) { Debug.Assert(predicates[i].Type() == exact, "Exact followed by another query predicate type is not supported at this moment."); values[i] = ((IndexQuery.ExactPredicate)predicates[i]).value(); } return(LuceneDocumentStructure.newSeekQuery(values)); case exists: foreach (IndexQuery p in predicates) { if (p.Type() != IndexQuery.IndexQueryType.exists) { throw new IndexNotApplicableKernelException("Exists followed by another query predicate type is not supported."); } } return(LuceneDocumentStructure.newScanQuery()); case range: AssertNotComposite(predicates); switch (predicate.ValueGroup()) { case NUMBER: IndexQuery.NumberRangePredicate np = (IndexQuery.NumberRangePredicate)predicate; return(LuceneDocumentStructure.newInclusiveNumericRangeSeekQuery(np.From(), np.To())); case TEXT: IndexQuery.TextRangePredicate sp = (IndexQuery.TextRangePredicate)predicate; return(LuceneDocumentStructure.newRangeSeekByStringQuery(sp.From(), sp.FromInclusive(), sp.To(), sp.ToInclusive())); default: throw new System.NotSupportedException(format("Range scans of value group %s are not supported", predicate.ValueGroup())); } case stringPrefix: AssertNotComposite(predicates); IndexQuery.StringPrefixPredicate spp = (IndexQuery.StringPrefixPredicate)predicate; return(LuceneDocumentStructure.newRangeSeekByPrefixQuery(spp.Prefix().stringValue())); case stringContains: AssertNotComposite(predicates); IndexQuery.StringContainsPredicate scp = (IndexQuery.StringContainsPredicate)predicate; return(LuceneDocumentStructure.newWildCardStringQuery(scp.Contains().stringValue())); case stringSuffix: AssertNotComposite(predicates); IndexQuery.StringSuffixPredicate ssp = (IndexQuery.StringSuffixPredicate)predicate; return(LuceneDocumentStructure.newSuffixStringQuery(ssp.Suffix().stringValue())); default: // todo figure out a more specific exception throw new Exception("Index query not supported: " + Arrays.ToString(predicates)); } }