Using LNVFNavigator of C++ API

Hi there,

I am trying to write a program interface using the Lotus C++ API. The program is suppose to able access the documents from the notes database.

Currently, i am using LNViewFolder::FTSearch retrieved a specific record. This is working fine, until i notice that the the search function does not work until a Full Text Index is created in the Lotus Notes Interface. Also without the index being updated, the LNNavigator does not seems to work as well.

Is there anyway to create the Index or update the index using the C++ API? Or is there any other way to go around this problem? I thank all who can give me a bit of advice or at least give me some lead on this matter.

Thanks to all in advance. Attached below is my sample code. I must add that there is nothing wrong with my codes though. Just missing some codes to create the full text index.

    LNNotesSession	Session;

LNDatabase db;

LNDocument EntryDoc;

LNINT i, count = 0, maintopics = 0;

LNString TheUser,MyField,LnstrDocFullName;

LNViewFolder view;			//view Contacts

LNVFEntry entry,NavEntry;            // Working entry

LNText LastName,EntryDocFullName;

LNFormFieldArray FormFieldArray;

LNFormField MyFormField;

LNVFNavigator nav;



int MyCount=0;

char strNumDocsbuffer[100];



Session.Init();



Session.GetDatabase("names.nsf", &db);



db.Open();



db.GetViewFolder("Contacts", &view);



view.Open();





if(view.FTSearch("John",&nav) == 0)

{

	MessageBox("Found");



	if(nav.GotoFirst(&NavEntry) == 0)

		MessageBox("Moved to first topic");

		

	if(NavEntry.GetDocument(&EntryDoc) == 0)

	{

		EntryDoc.Open();



		EntryDoc.GetItem("FullName", &EntryDocFullName);

		EntryDocFullName.GetText(&LnstrDocFullName);



		MessageBox(LnstrDocFullName);

		

		EntryDoc.Close();

	}

		

}



view.Close();



db.Close();



Session.Term();

Subject: Using LNVFNavigator of C++ API

you can use c-api FTIndex to create a fulltext, but this doesn’t work for remote-dbs.

LNDatabase::Search allows you to search for specific notes, but that will be much slower.

Do you really need fulltext search? Maybe you’ll find a workaround? c-api gives you more control for searches (you can limit search to specific views/folders, by time…)

Markus Seitz

markus.seitz@icodex.com

Subject: RE: Using LNVFNavigator of C++ API

Hi Markus, Thanks for your reply.

Sorry i am not too sure about the different type of search. Is the FTSearch really that slow for example if i am to have 1000 records in the database.

For the workaround, do you mean using LNAgent to do the search? Using search like SearchByAuthors, SearchByDate etc?

Thanks once again for your reply. Really appreciate it

Subject: RE: Using LNVFNavigator of C++ API

FTSearch is fast, based on prior created full text index…

You can use LNDatabase::Search to get similar, but slower results.

you can use c-api to make searches based on views, … (gives you more options to limit searches / get better performance).

but using such things should only be considered if you can’t change db-design and find no views you can use.

using views is the way to go (if you can), you can define which docs should be displayed, in which order, …

so it will depend on what you’re going to do, tell me more…

Markus Seitz

markus.seitz@icodex.com

Subject: RE: Using LNVFNavigator of C++ API

Actually i am just to create a User interface to access(add/edit/delete) the names.nsf and the calendar database. Currently i am trying to develop a search function to be incorporate to the interface.

So it will be good if i can actually which fields to search for. For example if i would want to search for John in the ‘FirstName’ column and not John from every other column as what the FTSearch and LNViewFolder::Find function is doing now.

Also can you tell me how to search for a range of dates. Do i have to define an LNAgent to use its LNSearch function? I notice there is a LNSearchByDateInField function. Is that the functions to use in this case?

Thanks for your help, Markus.

Regards

Subject: RE: Using LNVFNavigator of C++ API

i think FTSearch can also be limited to certain fields…

LNSearch (not shure) needs an agent stored in db, so can’t be used without changing db.

LNDatabase::Search takes as input LNSearchOptions. Using ::SetBeginDate/SetEndDate you can limit search to only a subset of documents. (will be faster than including this in searchformula, but i’m not shure).

Limiting search to certain fields is easy, just create your own search formula. (as used for views).

Markus Seitz

markus.seitz@icodex.com

Subject: RE: Using LNVFNavigator of C++ API

Hi Markus, thanks a million for your help.