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



Sep 29, 2011, 1:42 AM
4 Posts

FTSearch and dates

  • Category: Server Side JavaScript
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags: FTSearch
  • Replies: 3
 I'm having problems with a FTSearch.   
The FTSearch returns documents when searching for a city or zip code, but returns zero docs  
when applied to a text field containing an ISO date. 
 
Ultimately, I want to be able to do greater than and less than on two dates. 
 
Any help would be appreciated.
 
 
 
======Code ==========
var s:NotesSession = session;
var serverName:String = applicationScope.currentServerName;
var DB:NotesDatabase = s.getDatabase(serverName, applicationScope.pathFestivals);
DB.updateFTIndex(true);

// var userPrefQuery  = "[StartDate_ISO] = 2011-10-01";  //doesn't work  (text field with ISO date)
// var userPrefQuery  = "[City] = Seattle";         //works
// var userPrefQuery  = "[Zip] = 90291";         //works

var DC:NotesDocumentSelection = DB.FTSearch(userPrefQuery,0);
var folderName:String = sessionScope.ProfileID;

sessionScope.userPrefQuery = userPrefQuery;

log.logEvent("DC count:  " + DC.getCount());
log.logEvent("userPrefQuery:  " + userPrefQuery);


===== Results =============

query:  :  [evt_StartDate_ISO] = 2011-10-01
DC = count:  0

query:    [evt_City] = Seattle
DC = count:  42

query:  [evt_Zip] = 90291
DC = count:  23
Sep 29, 2011, 5:17 AM
14 Posts
Re: FTSearch and dates
Hi,
 
I suggest putting the strings to search for in quotes, otherwise the server will try to interpret the argument as a date or a number.
 
var userPrefQuery  = '[StartDate_ISO] = "2011-10-01"';
 
Sep 29, 2011, 7:16 AM
261 Posts
Re: FTSearch and dates
If you want to be able to do searches using greater than and less than on two dates you have two options:
  • perform the query on actual date fields
  • perform the query on fields that contain a number representation of the dates (e.g. 20111001)
I've had some problems in the past with performing FT queries on date fields that were related to an incorrect field datatype stored in the database's UNK table (see also http://www-10.lotus.com/ldd/nd6forum.nsf/0/6976b1cd5642d70e8525718500749106?OpenDocument). You might want to check into that.
 
Mark


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