//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustSelectStringForStringSuffixPredicate() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MustSelectStringForStringSuffixPredicate() { // given IndexQuery.StringSuffixPredicate stringPrefix = IndexQuery.stringSuffix(PROP_KEY, stringValue("abc")); // then VerifyQueryWithCorrectReader(ExpectedForStrings(), stringPrefix); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldComputeIndexUpdatesForRangeSeekBySuffixWhenThereArePartiallyMatchingNewNodes() internal virtual void ShouldComputeIndexUpdatesForRangeSeekBySuffixWhenThereArePartiallyMatchingNewNodes() { // GIVEN ReadableTransactionState state = (new TxStateBuilder()).WithAdded(40L, "Aaron").withAdded(41L, "Agatha").withAdded(42L, "Andreas").withAdded(43L, "Andrea").withAdded(44L, "Aristotle").withAdded(45L, "Barbara").withAdded(46L, "Barbarella").withAdded(47L, "Cinderella").build(); // WHEN IndexQuery.StringSuffixPredicate indexQuery = IndexQuery.stringSuffix(outerInstance.index.Schema().PropertyId, stringValue("ella")); AddedAndRemoved changes = indexUpdatesForSuffixOrContains(state, outerInstance.index, indexQuery, IndexOrder.NONE); AddedWithValuesAndRemoved changesWithValues = indexUpdatesWithValuesForSuffixOrContains(state, outerInstance.index, indexQuery, IndexOrder.NONE); // THEN outerInstance.AssertContains(changes.Added, 46L, 47L); outerInstance.AssertContains(changesWithValues.Added, NodeWithPropertyValues(46L, "Barbarella"), NodeWithPropertyValues(47L, "Cinderella")); }
//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)); } }