This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Aug 11, 2011, 11:48 AM
129 Posts

Re: FTSearch: problem getting a subset of the results

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.1
  • Role: Developer
  • Tags: FTSearch subset slice()
  • Replies: 5
I haven't used the subtract method of NotesDocumentCollection, so I'm not sure if this works, but it might be worth a try.
 
// After the collection is built... 
var removeCount = collection.getCount()  - 500;
if( removeCount <= 0 ){ return collection; } 
 
// Trim the collection to 500 documents 
for( var i = 0; i <= removeCount; i++ ){
   collection.subtract( collection.getLastDocument().getNodeID() );
 
return collection; 
Aug 11, 2011, 7:31 PM
14 Posts
Re: FTSearch: problem getting a subset of the results
Hiya, Tommy,
 
Thanks for the suggestion.  I couldn't get it to work, though.  It's probably me... I'm very flat-footed with the code.
 
Here is what I tried:
 
if(parseCriteria(asearch)){

        entries.FTSearch(asearch, maxreturn);
        resultNum = entries.getCount();
        var removeCount = entries.getCount()  - 500;
        sessionScope.resultDesc = "Alliance Search Results: "+resultNum+" results found.";
        sessionScope.searchString = asearch;
 
        if (resultNum > 0) {
            viewScope.unidCollection = getUnidCollection(entries);            
      if (resultNum >= topResults){
                viewScope.tooManyResults = true;
                /*
                viewScope.ResultDisplay = '<font color="red">*Your search has yielded ' +resultNum +' results.*</font><br><br>' +
                'We have listed the most recent 500 results for this search.  If you wish to view other records for this search, '+
                'please go ' +
                '<a href="AllianceSearchBuilder.xsp"><font color="blue">BACK</a></font> ' +
                'and revise the search for a more accurate result set.<br><br><br>';          
                */
            }
            
            if (resultNum < topResults) {
            viewScope.ResultDisplay = resultNum+" results<br>";
                }
 
           // Trim the collection to 500 documents
            for( var i = 0; i <= removeCount; i++ ){
             entries.subtract( entries.getLastDocument().getNodeID() );
            }
 
            return getArray(entries);                
        }else{
            viewScope.ResultDisplay = '<!-- SEARCH RESULTS TOP INFO DISPLAY --><table width="100%" cellpadding="10" cellspacing="0"><tr><td>' +
            '<font size="2">No Result Found from your Search Criteria.</font></td></tr></table><!-- END SEARCH RESULTS -->';        
        }    
    }else{
        viewScope.ResultDisplay = '<!-- SEARCH RESULTS TOP INFO DISPLAY --><table width="100%" cellpadding="10" cellspacing="0"><tr><td>' +
        '<font size="2">There was ERROR with Search Criteria.</font></td></tr></table><!-- END SEARCH RESULTS -->'+asearch;            
    }

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal