Add Method

This method adds a column to the list of columns (IColumn interfaces).

Syntax

IColumns.Add(Name, Description, Type, PropGuid, PropPid, Index, Retrieve, Length)

Parameters

Name

The name of the column. Sets the Name property of the resulting column to this value.

Description

A textual description of the column. Sets the Description property of the resulting column to this value.

Type

The data type of the column. Sets the Type property of the resulting column to this value.

Type VBScript VarType
BOOL vbBoolean
FILETIME vbDate
I4 vbLong
LPSTR vbString
LPWSTR vbString

PropGuid

The property set GUID. Sets the PropGuid property of the resulting column to this value.

PropGuid and PropPid uniquely identify a column for indexing, searching, and retrieving.

PropPid

The property ID. Sets the PropPid property of the resulting column to this value.

Index

If True, Search indexes the information in this column.

Retrieve

If True, Search retrieves the information in this column; if False, Search does not retrieve the information in this column. Sets the Retrieve property of the resulting column to this value.

Length

Length is reserved and should always be set to zero.

Remarks

Search does not validate the values of this method's parameters until you call the ISearchSchema.Save method.

You should check the Err.Number property after both the Add and the ISearchSchema.Save methods to ensure that the column was added successfully.

Example

The following example adds the HitCount column to the schema for the KMSampleCatalog1 catalog definition.

Option Explicit 
On Error Resume Next

Dim objSearchAdmin, objBuildServer, objCatalogs, objCatalog, objSchema, objColumns, objColumn 
Dim Name, Description, Type, PropGuid, PropPid, Index, Retrieve, Length 

Set objSearchAdmin = CreateObject("Search.SearchAdmin.1")
Set objBuildServer = objSearchAdmin.BuildServer
Set objCatalogs = objBuildServer.BuildCatalogs 
Set objCatalog  = objCatalogs("KMSampleCatalog1")
Set objSchema   = objCatalog.objSchema
Set objColumns  = objSchema.objColumns

Name        = " HitCount" 
Description = "The number of hits (words matching query) in file" 
Type        = "I4" 
PropGuid    = "49691c90-7e17-101a-a91c-08002b2ecda9" 
PropPid     = "4" 
Index       = False 
Retrieve    = True 
Length      = 0 

Set objColumn = objColumns.Add Name, Description, Type, PropGuid, PropPid, 
  Index, Retrieve, Length 

...

'Release objects
Set objColumn   = Nothing 
Set objColumns  = Nothing 
Set objSchema   = Nothing 
Set objCatalog  = Nothing 
Set objCatalogs = Nothing 
Set objBuildServer = Nothing 
Set objSearchAdmin = Nothing 
 

See Also

Clear, Count, IColumn interface, Remove


© 1997-1998 Microsoft Corporation. All rights reserved.