Texis Direct API

Post Reply
kevinw
Posts: 4
Joined: Mon Jan 08, 2001 4:12 pm

Texis Direct API

Post by kevinw »

How to create index with virtual fields using Texis Direct API?
bart
Posts: 251
Joined: Wed Apr 26, 2000 12:42 am

Texis Direct API

Post by bart »

The same way you create any other index. Just put the backslash between the fields (\).
kevinw
Posts: 4
Joined: Mon Jan 08, 2001 4:12 pm

Texis Direct API

Post by kevinw »

I have trouble using the createindex() API to create a Metamorph index table after creating the content table.
This code fragment:

char ftbname[1024];
char *tbname="product"; /* content table name */
char findname[1024];
char *indname="prodbod"; /* index table name */
char *fldname = "Title\\LongDesc"; /* virtual field */

dic = ddopen(qp->files);
if(dic!=(DDIC *)NULL && permstexis(dic,qp->user,"")!=-1)
{
strcpy(ftbname, tbname);

dd = opendd();
if ((dd == DDPN ||
!putdd(dd, "id", "counter", 1, 1) ||
!putdd(dd, "Title", "varchar", 300, 1) ||
!putdd(dd, "LongDesc", "varchar", 10000, 1) ||
(tb = createdbtbl(dic, dd, ftbname, tbname, "Index database.", 'T')) == (DBTBL *)NULL))
{
... /* error handler */
}
else
{
strcpy(findname, indname);

if(createindex(dic,findname,indname,tbname,fldname,1,'3')==-1)
{
... /* error handler */
}
}
}

It produces "Access Violation" error at createindex() API call.
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Texis Direct API

Post by John »

In general if you are doing things that can be accomplished with SQL it is easier to use one of the SQL level APIs, and compile with NCGDIRECT. You could use the n_texis call to issue the SQL directly.

If you are using the API you have above there are defines for the various index types that you might find more useful than the '3' which is the old style Metamorph index that is no longer supported.

INDEX_FULL: same as CREATE METAMORPH INVERTED INDEX
INDEX_MM: same as CREATE METAMORPH INDEX
INDEX_BTREE: same as CREATE INDEX
INDEX_UNIQUE: same as CREATE UNIQUE INDEX
INDEX_INV: same as CREATE INVERTED INDEX
John Turnbull
Thunderstone Software
kevinw
Posts: 4
Joined: Mon Jan 08, 2001 4:12 pm

Texis Direct API

Post by kevinw »

Hi,

Thanks for your help. I replaced '3' (INDEX_3DB) with INDEX_FULL and INDEX_MM, and got the same "Access Violation" error. The INDEX_BTREE and INDEX_UNIQUE worked fine but they are not for Metamorph index. Is there another way I could use createindex() to build Metamorph index instead of using n_texis?
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

Texis Direct API

Post by John »

Yes. It seems that the APICP that is used to determine the noise list is not initialized before you call createindex. You should add the following code before you call createindex().

extern APICP *globalcp;

if(globalcp == (APICP *)NULL) globalcp = TXopenapicp();
John Turnbull
Thunderstone Software
Post Reply