0

I have a DB that must be full text indexed, so I added the code below to create one if it is not allready indexed:

if (database.isFTIndexed()){
    database.updateFTIndex(false)
} else {
    var options:int = database.FTINDEX_ALL_BREAKS + database.FTINDEX_ATTACHED_FILES + database.FTINDEX_IMMEDIATE
    database.createFTIndex(options , true);
    database.updateFTIndex(false);
}
sessionScope.put("ssSelectedView","vwWFSProfile")

When it runs I get the following error: Error source Page Name:/xpWFSAdmin.xsp Control Id: button2 Property: onclick

Exception Error while executing JavaScript action expression com.ibm.jscript.types.GeneratedWrapperObject$StaticField incompatible with com.ibm.jscript.types.FBSValue

Expression

1: #{javascript:if (database.isFTIndexed()){ 2: database.updateFTIndex(false) 3: } else { 4: var options:int = database.FTINDEX_ALL_BREAKS + database.FTINDEX_ATTACHED_FILES + database.FTINDEX_IMMEDIATE 5: database.createFTIndex(options , true); 6: database.updateFTIndex(false); 7: } 8: sessionScope.put("ssSelectedView","vwWFSProfile")}

It is choking on line 4 it does not like the summing of the parameters. So I comment out line 4 and change line 5 to read database.createFTIndex(4, true) then I get this error:

Error while executing JavaScript action expression Script interpreter error, line=5, col=18: [TypeError] Exception occurred calling method NotesDatabase.createFTIndex(number, boolean) null

JavaScript code

1: if (database.isFTIndexed()){ 2: database.updateFTIndex(false) 3: } else { 4: //var options:int = database.FTINDEX_ALL_BREAKS + database.FTINDEX_ATTACHED_FILES + database.FTINDEX_IMMEDIATE 5: database.createFTIndex(4 , true); 6: database.updateFTIndex(false); 7: } 8: sessionScope.put("ssSelectedView","vwWFSProfile")

Can't seem to get it to work. I can go into the DB and manually create the index so it is not a rights issue.

Bill F
  • 2,057
  • 3
  • 18
  • 39

1 Answers1

3

As far as I can read from the help, you can not use database.FTINDEX_IMMEDIATE as parameter for createFTIndex() only for setFTIndexFrequency().

So remove the use of database.FTINDEX_IMMEDIATE and do this:

var options:int = database.FTINDEX_ALL_BREAKS + database.FTINDEX_ATTACHED_FILES;
database.createFTIndex(options , true);

You can then call setFTIndexFrequency() like this:

database.setFTIndexFrequency(database.FTINDEX_IMMEDIATE);
Per Henrik Lausten
  • 21,331
  • 3
  • 29
  • 76
  • Will try that. I had a single piece of code where I setFTIndexFrequency to Immediate didn't realize it could not be used in the options. Now that I look at the Help I overlooked the issue of Immediate could not be called as an option. It is not really obvious, but it is there. Thanks – Bill F Dec 10 '13 at 21:24
  • I have gone a bit further really confusing. I created a simple XPage with just a button and this code:
    if (database.isFTIndexed()){ database.updateFTIndex(false) } else { database.createFTIndex(0 , false); database.setFTIndexFrequency(4); database.updateFTIndex(false); }
    If Irun this on the local replica copy it works fine. If I try to run it on the server copy I get a 500 error and the index is not created. tried using database.FTINDEX_ALL_BREAKS and it fails all the time so just added the numbers. I have to step away from this for awhile, I'm so frustrated.
    – Bill F Dec 15 '13 at 23:02