Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX - |
Contents
Index
![]() ![]() |
Part 2 Developing Applications by APIs | > Chapter 10 Developing .NET Applications | > 10.3 How to Use .NET APIs | > 10.3.2 Data Searches |
The response performance of the sort or aggregation can be stable by setting the maximum value of number of hits. If the number of hits exceeds the maximum value, the sort or aggregation process will be stopped and the number of hits that match the search condition will be returned.
Add a condition to the search expression and narrow the scope of the search for sort or aggregation to prevent the number of hits exceeding the maximum value.
Use the HitCountLimit properties to set the maximum value of number of hits.
The following diagram shows the flow of setting maximum value of number of hits.
ShunService service = new ShunService(); service.Connect(); ShunSearchRequirement req = new ShunSearchRequirement(); req.QueryExpression = "/document/base/prefecture == 'Sydney'"; req.ReturnExpression = "/document/base/name, /document/base/price"; req.SortExpression = "val(/document/base/price/text()) DESC"; req.HitCountLimit = 10000; (1) ShunResultSet rs = service.Search( req ); if ( rs.IsHitCountLimitOver ) { (2) Console.WriteLine ("The number of hits has exceeded the maximum value."); Console.WriteLine ("[Numer of hits] = " + rs.HitCount); (3) } else{ Console.WriteLine("[Number of hits] = " + rs.HitCount); int i = 0; foreach ( ShunRecord record in rs.Records ) { ++i; Console.WriteLine( "[Result] Item No.{0} = {1}", i, record.Data ); } } service.Disconnect(); |
Set the maximum value of number of hits at the parameter in HitCountLimit properties.
If the sort expression is not set, the error will occur when executing the Search method.
Check whether the number of hits exceeds the maximum value at the IsHitCountLimitOver properties.
If the number of hits has exceeded the maximum value, only the number of hits can be extracted.
Contents
Index
![]() ![]() |