Skip to content

Commit

Permalink
HSEARCH-2254 Test sorting composing with nested object
Browse files Browse the repository at this point in the history
Restoring then_flattened_nested_limit2 test method
  • Loading branch information
fax4ever authored and yrodiere committed Sep 11, 2019
1 parent 1c41121 commit 95cca16
Showing 1 changed file with 21 additions and 0 deletions.
Expand Up @@ -234,6 +234,27 @@ public void then_nested_normal_limit1() {
.isDocRefHit( INDEX_NAME, DOCUMENT_2, DOCUMENT_3 );
}

@Test
public void then_flattened_nested_limit2() {
SearchQuery<DocumentReference> query;

String normalField = indexMapping.identicalForFirstTwo.relativeFieldName;
String flattenedField = "flattened." + indexMapping.flattenedField.relativeFieldName;
String nestedField = "nested." + indexMapping.flattenedField.relativeFieldName;

query = simpleQuery( f -> f.byField( flattenedField ).asc().then().byField( normalField ).asc() );
// [a b a][a a b] => {[1 3] 2}
assertThat( query.fetch( 2 ) ).hasDocRefHitsExactOrder( INDEX_NAME, DOCUMENT_1, DOCUMENT_3 );

query = simpleQuery( f -> f.byField( nestedField ).asc().then().byField( flattenedField ).asc() );
// [b a a][a b a] => {[3 2] 1}
assertThat( query.fetch( 2 ) ).hasDocRefHitsExactOrder( INDEX_NAME, DOCUMENT_3, DOCUMENT_2 );

query = simpleQuery( f -> f.byField( normalField ).asc().then().byField( nestedField ).asc() );
// [a a b][b a a] => {[2 1] 3}
assertThat( query.fetch( 2 ) ).hasDocRefHitsExactOrder( INDEX_NAME, DOCUMENT_2, DOCUMENT_1 );
}

@Test
public void then_flattened_nested_filterByPredicate() {
SearchQuery<DocumentReference> query;
Expand Down

0 comments on commit 95cca16

Please sign in to comment.