Skip to content

Commit

Permalink
#4 Testing that search works across multiple indexes and types + test…
Browse files Browse the repository at this point in the history
… case improvements / corrections
  • Loading branch information
DominicWatson committed Sep 3, 2012
1 parent a50e8f9 commit 6cc91a6
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions tests/integration/WrapperTest.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,6 @@
result = wrapper.search( index=indexName, q="*" );
super.assert( IsStruct( result ) and StructKeyExists( result, 'hits' ), "Result was not in expected format" );
super.assertEquals( nDocs, result.hits.total );
super.assertEquals( nDocs, ArrayLen( result.hits.hits ) );
</cfscript>
</cffunction>

Expand Down Expand Up @@ -384,7 +383,6 @@

super.assert( IsStruct( result ) and StructKeyExists( result, 'hits' ), "Result was not in expected format" );
super.assertEquals( nDocs, result.hits.total );
super.assertEquals( nDocs, ArrayLen( result.hits.hits ) );
</cfscript>
</cffunction>

Expand All @@ -402,7 +400,6 @@
super.assert( IsStruct( result ) and StructKeyExists( result, 'hits' ), "Result was not in expected format" );

super.assertEquals( nDocs, result.hits.total );
super.assertEquals( nDocs, ArrayLen( result.hits.hits ) );
</cfscript>

</cffunction>
Expand All @@ -420,14 +417,38 @@

super.assert( IsStruct( result ), "Result not in expected format" );
super.assertEquals( nDocs, result.hits.total );
super.assertEquals( nDocs, ArrayLen( result.hits.hits ) );
</cfscript>
</cffunction>

<cffunction name="t20_search_shouldSearchAcrossMultipleIndexesAndMultipleTypes" returntype="void">
<cfscript>
var result = "";
var nDocsExpected = 0;

nDocsExpected += _addABunchOfDocs( "index1", "type1" );
nDocsExpected += _addABunchOfDocs( "index1", "type3" );
nDocsExpected += _addABunchOfDocs( "index3", "type1" );
nDocsExpected += _addABunchOfDocs( "index3", "type3" );

_addABunchOfDocs( "index1", "type2" );
_addABunchOfDocs( "index2", "type1" );
_addABunchOfDocs( "index2", "type2" );
_addABunchOfDocs( "index2", "type3" );
_addABunchOfDocs( "index3", "type2" );

wrapper.refresh();

result = wrapper.search( index="index1,index3", type="type1,type3", q="*" );

super.assert( IsStruct( result ), "Result not in expected format" );
super.assertEquals( nDocsExpected, result.hits.total );
</cfscript>
</cffunction>

<!--- private --->
<cffunction name="_teardownTestIndexes" access="private" returntype="void" output="false">
<cftry>
<cfset wrapper.deleteIndex( indexName ) />
<cfset wrapper.deleteIndex( "_all" ) />
<cfcatch>
</cfcatch>
</cftry>
Expand Down

0 comments on commit 6cc91a6

Please sign in to comment.