Skip to content

Commit

Permalink
#4 Allowing search across all indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicWatson committed Aug 31, 2012
1 parent cd45460 commit f1f27fc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cfelasticsearch/api/Wrapper.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@
</cffunction>

<cffunction name="search" access="public" returntype="struct" output="false">
<cfargument name="index" type="string" required="true" />
<cfargument name="q" type="string" required="true" />
<cfargument name="index" type="string" required="false" />
<cfargument name="type" type="string" required="false" />

<cfscript>
Expand Down
21 changes: 21 additions & 0 deletions tests/integration/WrapperTest.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,27 @@
</cfscript>
</cffunction>

<cffunction name="t18_search_shouldSearchAcrossAllIndexes_whenNoIndexSupplied" returntype="void">
<cfscript>
var result = "";
var indexName = "someIndex";
var nDocs = _addABunchOfDocs( indexName, "sometype" );

nDocs = nDocs + _addABunchOfDocs( indexName, "someOtherType" );

wrapper.refresh( indexName );

result = wrapper.search( q="*" );
super.assert( IsStruct( result ) and StructKeyExists( result, 'hits' ), "Result was not in expected format" );

debug( result );

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

</cffunction>

<!--- private --->
<cffunction name="_teardownTestIndexes" access="private" returntype="void" output="false">
<cftry>
Expand Down

0 comments on commit f1f27fc

Please sign in to comment.