PeopleSoft Search Framework Classes

This chapter provides an overview of the PeopleSoft Search Framework classes and discusses:

Click to jump to parent topicUnderstanding the PeopleSoft Search Framework Classes

In previous PeopleTools releases, search functionality was provided in a non-declarative fashion in which search engine indexes were built using custom PeopleCode and Application Engine programs. Each PeopleSoft application used a unique method for creating and maintaining search artifacts like collections and indexes—all of which required search engine-specific calls, commands, syntax, and so on.

The PeopleSoft Search Framework enables application developers and implementation teams to create search artifacts in a declarative manner and to deploy and maintain search indexes using one standard interface, regardless of PeopleSoft application.

The PeopleSoft Search Framework consists of PeopleSoft components (pages and records provided by PeopleTools), which provide a centralized interface for configuring PeopleSoft integration with the search engine, creating search artifacts such as search definitions and search categories, and building and maintaining search indexes.

In addition to the user interface, the PeopleSoft Search Framework is supported by several PeopleCode application classes including PT_SEARCH and several PTSF application packages. The PT_SEARCH application package provides the administration and query service interfaces for integration with web service based free-text search engines. The root package comprises a factory class, interfaces, superclasses, and implementations for classes that are not dependent on a specific search engine.

See Also

PeopleTools 8.52: PeopleSoft Search Technology PeopleBook

Click to jump to parent topicDifferences Between the PeopleSoft Search Framework Classes and Verity Search Classes

The Verity search classes were implemented specifically to support PeopleTools integration with the Verity search engine. Conversely, the PeopleSoft Search Framework was developed to provide an interaction layer that is independent of any specific search engine. In particular, the PeopleSoft Search Framework classes documented in this chapter are general purpose classes not associated with any particular search engine.

The PeopleSoft Search Framework was designed to integrate with any number of free-text search solutions, each of which could be implemented as a subpackage under the PT_SEARCH application package. At this time, the only search solution supported by PeopleTools “as delivered” is Oracle Secure Enterprise Search (SES), which is implemented in the PT_SEARCH:SESIMPL subpackage.

The Verity search objects are implemented as PeopleCode built-in objects. PeopleSoft Search Framework objects are implemented through an open source PeopleCode application package. In both cases, the primary interaction class is the SearchQuery class. With Verity, a SearchQuery object is instantiated using the PortalRegistry or Session built-in classes. With the PeopleSoft Search Framework, a SearchQuery object is instantiated from a SearchQueryService object. The SearchQueryService object itself is created using the SearchFactory class.

See Also

Verity Search Classes

Instantiating a SearchQuery Object

Click to jump to parent topicInstantiating a SearchQuery Object

With the PeopleSoft Search Framework, a SearchQuery object is instantiated by instantiating a SearchFactory object, which is used to create a SearchQueryService object. The SearchQuery object is then instantiated from the SearchQueryService.

The high-level program flow is as follows:

import PT_SEARCH:SearchFactory; import PT_SEARCH:SearchQueryService; import PT_SEARCH:SearchQuery; Local PT_SEARCH:SearchFactory &factory = create PT_SEARCH:SearchFactory(); Local PT_SEARCH:SearchQueryService &svc = &factory.CreateQueryService("default"); Local PT_SEARCH:SearchQuery &srchQuery = &svc.CreateQuery();

Click to jump to top of pageClick to jump to parent topicImporting PeopleSoft Search Framework Classes

The PeopleSoft Search Framework classes are application classes, not built-in classes, like Rowset, Field, Record, and so on. Before you can use these classes in your PeopleCode program, you must import them into your program.

An import statement either names a particular application class or imports all the classes in a package.

Using the asterisks after the package name makes all the application classes directly contained in the named package available. Application classes contained in subpackages of the named package are not made available.

Click to jump to parent topicPerforming a Simple Search

The following example code demonstrates how to retrieve properties of the SearchResultCollection and how to iterate over the results in the collection:

  1. Import the application package.

    import PT_SEARCH:*;

  2. Create an instance of SearchQueryService and SearchFactory.

    Local PT_SEARCH:SearchFactory &factory = create PT_SEARCH:SearchFactory(); Local PT_SEARCH:SearchQueryService &svc = &factory.CreateQueryService("default");

  3. Instantiate the SearchQuery object.

    Local PT_SEARCH:SearchQuery &srchQuery = &svc.CreateQuery();

  4. Initialize the search query by setting properties.

    &srchQuery.QueryText = "some text"; &srchQuery.Language = &lang_cd; &srchQuery.MarkDuplicates = False; &srchQuery.RemoveDuplicates = False;

  5. Execute the search query.

    Use the Execute method and specify two integer parameters: start determines the index of the first document, size determines the number of search documents to return "page" of results.

    Local number &start = 1; Local number &size = 10; Local PT_SEARCH:SearchResultCollection &results; &results = &srchQuery.Execute(&start, &size);

  6. Process the search query results

    The search query returns a SearchResultCollection. To process this collection: The SearchResultCollection contains SearchResult objects. Each SearchResult has its own methods to access its attributes such as Title, Summary, URL Link, and so on. Each SearchResult also optionally has custom attributes that can be accessed through the SearchFieldCollection object.

    Local number &i, &j; Local number &score; Local string &title; Local string &summary; Local datetime &lastMod; Local string &url; Local string &name; Local string &value; Rem - Get a couple return properties; Local number &docCount = &results.GetDocumentCount(); Local number &hitCount = &results.GetEstimatedHitCount(); Rem - Iterate through the search results; Local PT_SEARCH:SearchResult &curResult; Local PT_SEARCH:SearchFieldCollection &customs; For &i = 1 To &results.GetDocumentCount() &curResult = &results.Item(&i); &score = &curResult.GetScore(); &title = &curResult.GetTitle(); &summary = &curResult.GetSummary(); &lastMod = &curResult.GetLastModified(); &url = &curResult.GetUrlLink(); /* Do something with these result attributes */ Rem - Get the custom fields of the result if any; &customs = &curResult.GetCustomAttributes(); If (&customs <> Null) Then Rem - Iterate through custom fields of the result; For &j = 1 To &customs.Count() &name = &customs.Item(&j).Name; &value = &customs.Item(&j).Value; /* do something with the custom field */ End-For; End-If; End-For; Rem - Calculate the number of additional pages in the results; Local integer &pages; &pages = Idiv(&hitCount, &size); If Mod(&hitCount, &size) > 0 Then &pages = &pages + 1; End-If; Rem - Render the additional pages as links;

  7. Get the page number for the next request.

    Re-execute the search query to retrieve the next page. Increment start to the next page; then invoke the Execute method.

    Rem - Get the requested page from the link clicked by the user; Rem - Store the value in the &req_page variable; Local integer &req_page; Rem - Calculate the new start value and re-execute the query; &start = (&req_page - 1) * &size + 1; &results = &srchQuery.Execute(&start, &size);

The preceding example returns the results in chunks, or pages, which provides better query performance than returning all results at once. However, you could elect to return all results in a single search query. In that case, you will need to consider the maximum number of results returned by the search engine. For example, when SES is the search provider, 200 is the default value for the maximum number of results. In this case, the Execute method would be invoked as follows to return all results at once:

Local number &start = 1; Local number &size = 200; Local PT_SEARCH:SearchResultCollection &results; &results = &srchQuery.Execute(&start, &size);

See Also

Exception Handling

Click to jump to parent topicException Handling

The PeopleSoft Search Framework uses the try/catch exception construct to handle special conditions that interrupt normal program execution. When special runtime conditions are encountered, the PeopleSoft Search Framework will construct and throw objects of the Exception class or some class derived from the Exception class. There are two main categories of PeopleSoft Search Framework exceptions:

The second category of exceptions is necessarily search engine specific since these are coming from the search provider. For example, there are two exception classes defined in the SESIMPL application subpackage: SESQueryServiceException and SESAdminServiceException. As the names imply, the first can be thrown by calls to the SearchQueryService methods and the second can be thrown by calls to the SearchAdminService methods. Both of these exception classes expose SOAPFaultCode and SOAPFaultString properties that are returned by SES. The SESAdminServiceException exposes additional properties which are defined in Appendix B of the Oracle Secure Enterprise Search Administration API Guide.

See http://download.oracle.com/docs/cd/E14507_01/apirefs.1112/e14133/errors.htm#sthref1501

Virtually all methods of all classes in the PeopleSoft Search Framework can throw an exception; therefore, Oracle recommends that you put all calls to the PeopleSoft Search Framework classes within try-catch blocks.

The following example builds on the previous example that processed search results. In this example, the results processing is augmented by try-catch exception handling:

import PT_SEARCH:*; import PT_SEARCH:SESIMPL:EXCEPTION:*; /* instantiate and initialize the query object */ /* ... */ /* execute the query */ Local PT_SEARCH:SearchResultCollection &results; try &results = &qry.Execute(&start, &size); catch PT_SEARCH:SESIMPL:EXCEPTION:SESQueryServiceException &sesEx MessageBox(0, "", 0, 0, "The search could not be perfomed."); MessageBox(0, "", 0, 0, "The Search Provider returned an error."); MessageBox(0, "", 0, 0, "SOAP fault: ", &sesEx.SoapFaultString); WriteToLog(0, &sesEx.SoapFaultCode); WriteToLog(0, &sesEx.SoapFaultString); Exit; catch Exception &psEx MessageBox(0, "", 0, 0, "The search could not be perfomed."); MessageBox(0, "", 0, 0, "Exception: ", &psEx.DefaultText); WriteToLog(0, &psEx.DefaultText); Exit; end-try; /* process the results */ try Local number &docCount = &results.GetDocumentCount(); Local number &hitCount = &results.GetEstimatedHitCount(); Local PT_SEARCH:SearchResult &curResult; Local PT_SEARCH:SearchFieldCollection &customs; For &i = 1 To &results.GetDocumentCount() &curResult = &results.Item(&i); &score = &curResult.GetScore(); &title = &curResult.GetTitle(); &summary = &curResult.GetSummary(); &lastMod = &curResult.GetLastModified(); &url = &curResult.GetUrlLink(); /* do something with the values */ &customs = &curResult.GetCustomAttributes(); If (&customs <> Null) Then /* iterate over custom fields of the result */ For &j = 1 To &customs.Count() &name = &customs.Item(&j).Name; &value = &customs.Item(&j).Value; /* do something with the name/value pair */ End-For; End-If; End-For; catch Exception &ex /* encountered an exception while processing results */ /* inspect the exception to determine appropriate action */ end-try;

See Also

Exception Class

Click to jump to parent topicPeopleSoft Search Framework Classes Reference

This reference section documents the following classes from the PT_SEARCH application package:

This reference section also documents the following classes from the PTSF_SECURITY application package: SearchAuthnQueryFilter class.

Click to jump to parent topicFacetFilter Class

This section provides an overview of the FacetFilter class and discusses:

The FacetFilter class is used to filter the search results on one or more facet values. Facets are aspects, properties, or characteristics of a piece of data. In a PeopleSoft application, this could be PeopleSoft metadata (for example, SETID or business unit), or it could be any other attribute of the data. For example, job openings could be classified (faceted) by location, department or job family, working hours, pay scale, posting date, business unit, SETID, and so on. Facets allow for “filtered search” or “filtered navigation” of search results.

See Also

Working With Facets

Working with Search Results

Click to jump to parent topicFacetFilter Class Methods

In this section, the FacetFilter class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicFacetFilter

Syntax

FacetFilter(FacetName, Path)

Description

Use this constructor to instantiate a FacetFilter object for a specific facet to indicate the facet and path.

Parameters

FacetName

Specifies the name of the facet as a string.

Path

Specifies the value of the facet as a string.

Returns

A FacetFilter object.

Example

The following examples demonstrate four ways to create a facet filter:

See Also

GetFacetFilters

Click to jump to parent topicFacetFilter Class Properties

In this section, the FacetFilter class properties are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicFacetLabel

Description

Use this property to set or return the long description for the facet as a string. This description appears as the label for the facet in the user interface.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicFacetName

Description

Use this property to set or return the name of the facet as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicPath

Description

Use this property to set or return the value for facet as a path string.

This property is read-write.

Example

The Path property is implicitly set to the value of the Path parameter supplied in the constructor for the FacetFilter class. In this example, the Path property is set to USA/CA:

&facetFilter = create PT_SEARCH:FacetFilter("LOCATION","USA/CA")

However, the Path property can also be explicitly set as in the following example:

&facetFilter.Path = "USA/CO/Denver";

Click to jump to parent topicFacetNode Class

This section provides an overview of the FacetNode class and discusses:

The FacetNode class extends the FacetFilter class and is used to return the list of facet node values along with other information about the facet nodes.

Facet nodes are used to render the list of facet values of a particular facet for a given search. This list of facet nodes is retrieved using GetFacetNodes method of the SearchResultCollection. Since a facet node is constructed with a facet path, this information can be used to create a facet filter indicating that the user has chosen to filter the results further based on the facet node.

See Also

FacetFilter Class

GetFacetNodes

Click to jump to parent topicFacetNode Class Methods

In this section, the FacetNode class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicaddChild

Syntax

addChild(&node)

Description

Use this method to add a child facet node to the current facet node.

Parameters

&node

Specifies the child facet node as a FacetNode object.

Returns

None.

Click to jump to top of pageClick to jump to parent topicFacetNode

Syntax

FacetNode(FacetName, NodeName, Path, DisplayValue, DocCount)

Description

Use this constructor to instantiate a FacetNode object for a specific facet.

Parameters

FacetName

Specifies the name of the facet as a string and is used to refer to that member of the superclass.

NodeName

Specifies the name of this facet node as a string.

Path

Specifies the value of the facet as a string and is used to refer to that member of the superclass.

DisplayValue

Specifies the display value for this facet node as a string.

DocCount

Specifies an integer representing the number of documents that would be returned if this facet node were selected as a search filter.

Returns

A FacetNode object.

Click to jump to top of pageClick to jump to parent topicgetChildNodes

Syntax

getChildNodes()

Description

Use this method to return an array of child nodes.

Parameters

None.

Returns

An array of FacetNode objects.

See Also

addChild

Click to jump to parent topicFacetNode Class Properties

In this section, the FacetNode class properties are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicDisplayValue

Description

Use this property to set or return the display value for this facet node as a string.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicDocumentCount

Description

Use this property to set or return an integer representing the number of documents that would be returned if this facet node were selected as a search filter.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicFacetValue

Description

Use this property to set or return the value of this facet node as a string.

This property is read-write.

The FacetName, FacetValue, and DisplayValue are all closely related. For example, consider the following facet filter: FacetFilter("LOCATION","USA"). These properties would have the following values:

See Also

DisplayValue

FacetName

Click to jump to top of pageClick to jump to parent topicHasChildren

Description

Use this property to set or return a Boolean value indicating whether this facet node has children.

This property is read-write.

Click to jump to parent topicSearchAttribute Class

This section provides an overview of the SearchAttribute class and discusses:

The SearchAttribute class represents a search attribute, which is an alias to a search query field. Search attributes enable you to hide the attribute name and query field name from the end user, who will see the search attribute display name.

An array of search attributes are returned using the GetAllAttributes, GetConfiguredFilterAttributes, GetNonConfiguredFilterAttributes, and GetRequestedAttributes methods of the SearchCategory class.

See Also

GetAllAttributes

GetConfiguredFilterAttributes

GetNonConfiguredFilterAttributes

GetRequestedAttributes

Click to jump to parent topicSearchAttribute Class Methods

In this section, the SearchAttribute class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicSearchAttribute

Syntax

SearchAttribute(Name, Type)

Description

Use this constructor to instantiate a SearchAttribute object for a specific attribute.

Parameters

Name

Specifies the name of the attribute as a string .

Type

Specifies the type for this attribute as a one-character string. The values for Type can be as follows:

  • D – Date

  • N – Number

  • S – String

Returns

A SearchAttribute object.

Click to jump to parent topicSearchAttribute Class Properties

In this section, the SearchAttribute class properties are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicDisplay

Description

Use this property to set or return a string to be used as the display name for this attribute within the user interface.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicName

Description

Use this property to set or return a string representing the name of this search attribute.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicType

Description

Use this property to set or return a one-character sting indicating the type for this attribute. The values for this property can be as follows:

This property is read-write.

Click to jump to parent topicSearchCategory Class

This section provides an overview of the SearchCategory class and discusses:

SearchCategory is the PeopleCode representation of a search category definition, which groups search data source definitions. A search category is a searchable collection of indexes. SearchCategory objects can only be constructed by giving the name of a search category definition that has already been saved to the database. In general SearchCategory objects are instantiated either to be assigned to the Categories property of a SearchQuery object or to be passed to methods of the SearchAdminService.

Click to jump to parent topicSearchCategory Class Methods

In this section, the SearchCategory class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicGetAllAttributes

Syntax

GetAllAttributes()

Description

Use this method to return the union of all the attributes available across all the search definitions assigned to this search category.

Parameters

None.

Returns

An array of SearchAttribute objects.

See Also

SearchAttribute Class

Click to jump to top of pageClick to jump to parent topicGetConfiguredFilterAttributes

Syntax

GetConfiguredFilterAttributes()

Description

Use this method to return a list of advanced search filter attributes defined and configured for the advanced search for this search category. These are the attributes that have been configured on the Advanced Search Fields page.

Parameters

None.

Returns

An array of SearchAttribute objects.

See Also

SearchAttribute Class

Click to jump to top of pageClick to jump to parent topicGetFacetFilters

Syntax

GetFacetFilters()

Description

Use this method to return an array of facet filters for a specific search category. Dynamically building this array based on system metadata avoids the hard-coding of facet names in your PeopleCode programs. However, this means that this method can only be used for search categories defined on the local system (therefore, it cannot be used for universal search).

Parameters

None.

Returns

An array of FacetFilter objects.

See Also

FacetFilter Class

Click to jump to top of pageClick to jump to parent topicGetLastIndexedDateTime

Syntax

GetLastIndexedDateTime()

Description

Use this method to return a DateTime value representing the oldest index that is current from all the indexed search definitions in this category. If no search definition in this category has ever been indexed, this method returns Null.

Parameters

None.

Returns

A DateTime value.

Click to jump to top of pageClick to jump to parent topicGetNonConfiguredFilterAttributes

Syntax

GetNonConfiguredFilterAttributes()

Description

Use this method to return a list of advanced search filter attributes defined but not configured for the advanced search for this search category. These are the attributes that have been defined for the search category but not configured on the Advanced Search Fields page.

Parameters

None.

Returns

An array of SearchAttribute objects.

See Also

SearchAttribute Class

Click to jump to top of pageClick to jump to parent topicGetRequestedAttributes

Syntax

GetRequestedAttributes()

Description

Use this method to return the list of search attributes that have been configured as display-only attributes on the Display Fields page. Since this method returns the display label for these search attributes, you must also use the GetRequestedFields method to return the list of search fields to pass to the query API.

Parameters

None.

Returns

An array of SearchAttribute objects.

See Also

SearchAttribute Class

GetRequestedFields

Click to jump to top of pageClick to jump to parent topicGetRequestedFields

Syntax

GetRequestedFields()

Description

Use this method to return the list of search fields that have been configured as display-only attributes on the Display Fields page. This array can then be passed to the RequestedFields method of the SearchQuery class. Since this method returns the query field names for the search attributes, you must also use the GetRequestedAttributes method to return the display labels to display in the user interface.

Parameters

None.

Returns

An array of SearchField objects.

Example

PT_SEARCH:SearchCategory &cat = create PT_SEARCH:SearchCategory("MY_SRCH_CAT"); &qry.Categories = CreateArray(&cat); &qry.RequestedFields = &cat.GetRequestedFields();

See Also

GetRequestedAttributes

SearchField Class

RequestedFields

Click to jump to top of pageClick to jump to parent topicSearchCategory

Syntax

SearchCategory(Name)

Description

Use this constructor to instantiate a SearchCategory object populated with the data from the specified saved definition.

Parameters

Name

The name of the search category to instantiate as a string.

Returns

A SearchCategory object.

Example

import PT_SEARCH:SearchCategory; Local PT_SEARCH:SearchCategory &SrchCat = create PT_SEARCH:SearchCategory⇒ ("MySrchCat");

See Also

Categories

Constructors

Import Declarations

Click to jump to parent topicSearchCategory Class Properties

In this section, the SearchCategory class properties are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicDataSourceNames

Description

Use this property to return an array of string containing the names of the search definitions that have been assigned to this search category.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner.

Click to jump to top of pageClick to jump to parent topicDisplayname

Description

Use this property to return the long description (display) for the search category as a string.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner.

Click to jump to top of pageClick to jump to parent topicIsDeployed

Description

Use this property to return a Boolean value indicating whether this search category has been deployed to a search provider.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner.

Click to jump to top of pageClick to jump to parent topicName

Description

Use this property to return the name of this SearchCategory object as a string.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner.

Click to jump to top of pageClick to jump to parent topicServiceName

Description

Use this property to return a string representing the name of the search engine instance to which this search category has been deployed.

This property is effectively read-only.

Note. While this property is actually read-write, from PeopleCode, it is meant to be used in a read-only manner.

Click to jump to parent topicSearchFactory Class

This section provides an overview of the SearchFactory class and discusses:

The SearchFactory class is a concrete factory class used to instantiate search engine-specific implementations of the SearchQueryService and other services.

Click to jump to parent topicSearchFactory Class Methods

In this section, the SearchFactory class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicCreateQueryService

Syntax

CreateQueryService(name)

Description

Use this method to instantiate a search engine-specific SearchQueryService object. This search engine-specific search query service enables accessing search engine-specific attributes of a SearchQuery object

Parameters

name

Specifies the name of the search query service as a string.

Returns

A SearchQueryService object.

Example

import PT_SEARCH:SearchFactory; import PT_SEARCH:SearchQueryService; Local PT_SEARCH:SearchFactory &MySearchFactory = create PT_SEARCH:SearchFactory(); Local PT_SEARCH:SearchQueryService &MySrchQrySvc = &MySearchFactory.⇒ CreateQueryService("default");

See Also

SearchQueryService Class

Click to jump to top of pageClick to jump to parent topicSearchFactory

Syntax

SearchFactory()

Description

Use this constructor to instantiate a SearchFactory object, which allows you to instantiate a search-provider specific search query service.

Parameters

None.

Returns

A SearchFactory object.

Example

import PT_SEARCH:SearchFactory; Local PT_SEARCH:SearchFactory &MySearchFactory = create PT_SEARCH:SearchFactory();

Click to jump to parent topicSearchFactory Class Properties

In this section, the SearchFactory class properties are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicDEFAULTSERVICE

Description

This property returns the name of the default search engine service as a string.

This property is read-only.

Click to jump to parent topicSearchField Class

This section provides an overview of the SearchField class and discusses: .

The SearchField class is a superclass that requires implementation of a search engine-specific subclass. A SearchField is returned by the First, Item, ItemByName, and Next methods of the SearchFieldCollection class.

See Also

SearchFieldCollection Class

Click to jump to parent topicSearchField Class Methods

In this section, the SearchField class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicgetAsDate

Syntax

getAsDate()

Description

Use this method to return the Value property as a Date value.

Note. This is an abstract method.

Parameters

None.

Returns

A Date value.

See Also

Value

Click to jump to top of pageClick to jump to parent topicgetAsDateTime

Syntax

getAsDateTime()

Description

Use this method to return the Value property as a DateTime value.

Note. This is an abstract method.

Parameters

None.

Returns

A DateTime value.

See Also

Value

Click to jump to top of pageClick to jump to parent topicgetAsInteger

Syntax

getAsInteger()

Description

Use this method to return the Value property as a Integer value.

Note. This is an abstract method.

Parameters

None.

Returns

An Integer value.

See Also

Value

Click to jump to top of pageClick to jump to parent topicgetAsNumber

Syntax

getAsNumber()

Description

Use this method to return the Value property as a Number value.

Note. This is an abstract method.

Parameters

None.

Returns

A Number value.

See Also

Value

Click to jump to parent topicSearchField Class Properties

In this section, the SearchField class properties are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicName

Description

This property returns the name of the search field as a string.

This property is read-only.

See Also

ItemByName

Click to jump to top of pageClick to jump to parent topicType

Description

This property returns the data type of the search field as a one-character string as follows:

This property is read-only.

Click to jump to top of pageClick to jump to parent topicValue

Description

This property returns the value of the search field as a string. The Value property can be transformed from a String value to a Date, DateTime, Integer, or Number value using the methods of the SearchField class.

This property is read-only.

See Also

getAsDate, getAsDateTime, getAsInteger, getAsNumber.

Click to jump to parent topicSearchFieldCollection Class

This section provides an overview of the SearchFieldCollection class and discusses: SearchFieldCollection class methods.

The SearchFieldCollection class provides a collection of SearchField objects. Because the SearchFieldCollection class is a generic interface class, a search engine-specific subclass is required. A SearchFieldCollection is returned by the GetCustomAttributes method of the SearchResult class.

See Also

SearchField Class

GetCustomAttributes

Click to jump to parent topicSearchFieldCollection Class Methods

In this section, the SearchFieldCollection class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicCount

Syntax

Count()

Description

Use this method to return the number of SearchField objects in the SearchField collection as an integer.

Parameters

None.

Returns

An integer.

Click to jump to top of pageClick to jump to parent topicFirst

Syntax

First()

Description

Use this method to return the first SearchField object in the SearchField collection. If the SearchField collection is empty, this method returns Null.

Parameters

None.

Returns

A SearchField object if successful, Null otherwise.

See Also

SearchField Class

Click to jump to top of pageClick to jump to parent topicItem

Syntax

Item(index)

Description

Use this method to return the SearchField object at the position in the SearchField collection specified by the index parameter.

Parameters

index

Specifies the position of the SearchField object in the SearchField collection as an integer.

Returns

A SearchField object if successful, Null otherwise.

See Also

SearchField Class

Click to jump to top of pageClick to jump to parent topicItemByName

Syntax

ItemByName(name)

Description

Use this method to return the SearchField object specified by the name parameter.

Note. The ItemByName method does not set the index for the SearchField object returned. Therefore, the Next method cannot be used after a call to ItemByName.

Parameters

name

Specifies the name of the SearchField object as a string.

Returns

A SearchField object if successful, Null otherwise.

See Also

SearchField Class

Click to jump to top of pageClick to jump to parent topicNext

Syntax

Next()

Description

Use this method to return the next SearchField object in the SearchField collection. This method can only be invoked after a successful invocation of the First, Item, or Next methods.

Note. The ItemByName method does not set the index for the SearchField object returned. Therefore, the Next method cannot be used after a call to ItemByName.

Parameters

None.

Returns

A SearchField object if successful, Null otherwise.

See Also

First, Item.

SearchField Class

Click to jump to parent topicSearchFilter Class

This section provides an overview of the SearchFilter class and discusses:

The SearchFilter class creates a filter for search results (similar to building a WHERE clause in a SQL statement) that is passed to the SearchQuery class.

Click to jump to parent topicSearchFilter Class Methods

In this section, the SearchFilter class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicsetDateFilter

Syntax

setDateFilter(date)

Description

Use this method to set a Date value as the search filter.

Parameters

date

Specifies the search filter value as a Date value.

Returns

None.

Example

import PT_SEARCH:SearchFilter; Local PT_SEARCH:SearchFilter &Srchflter; Local date &Date = DateValue("10/09/11"); &Srchflter.setDateFilter(&Date);

See Also

Value

FormatDateFilter

Click to jump to top of pageClick to jump to parent topicsetDateTimeFilter

Syntax

setDateTimeFilter(datetime)

Description

Use this method to set a DateTime value as the search filter.

Parameters

datetime

Specifies the search filter value as a DateTime value.

Returns

None.

Example

import PT_SEARCH:SearchFilter; Local PT_SEARCH:SearchFilter &Srchflter; Local datetime &Date_TIME = DateTimeValue("10/13/97 10:34:25 PM"); &Srchflter.setDateTimeFilter(&Date_TIME);

See Also

Value

FormatDateTimeFilter

Click to jump to parent topicSearchFilter Class Properties

In this section, the SearchFilter class properties are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicField

Description

Use this property to set or return a SearchField object.

This property is read-write.

See Also

SearchField Class

Click to jump to top of pageClick to jump to parent topicOperator

Description

Use this property to set or return the operator for the filter as a string. Depending on the type of the search attribute, the following operators can be used:

Operator

String

Number

Date

equals

X

X

X

notequals*

X

X

X

contains

X

   

greaterthan

 

X

X

greaterthanequals

 

X

X

lessthan

 

X

X

lessthanequals

 

X

X

* The notequals operator can be used when EnableExtendedFilterOperators property is set to true.

This property is read-write.

See Also

Type

EnableExtendedFilterOperators

Click to jump to top of pageClick to jump to parent topicValue

Description

Use this property to set or return the value for the filter as a string.

This property is read-write.

Use this property only when setting a string or a number (represented as a string) as a filter. If you wish to set a Date or a DateTime value as a filter, use the setDateFilter and setDateTimeFilter methods, respectively

See Also

SearchFilter Class Methods.

setDateFilter

Click to jump to parent topicSearchQuery Class

This section provides an overview of the SearchQuery class and discusses:

The SearchQuery object is used to define the attributes of a search query—such as its category or categories (index or indexes), facet filters, query text, and so on—and then execute that query on a search engine instance. The required properties of a SearchQuery must be initialized before invoking the Execute method. However, which properties are required depend on the specific search engine. Moreover, all properties are not necessarily used for every execution of a search query. For example, if no filters are to be applied to the search then it is not necessary to initialize the Filter property.

A SearchQuery object is returned by the CreateQuery method of the SearchQueryService class.

See Also

CreateQuery

Click to jump to parent topicSearchQuery Class Methods

In this section, the SearchQuery class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicBrowseFacetNodes

Syntax

BrowseFacetNodes()

Description

Use this method to return an array of facet nodes with out actually executing a search. Because this method does not execute the search query, it is lot faster than the Execute method. This method relies on the Language property only and ignores other SearchQuery class properties and settings, such as facet filters.

Note. This is an abstract method.

Parameters

None.

Returns

An array of FacetNode objects.

See Also

FacetNode Class

Click to jump to top of pageClick to jump to parent topicExecute

Syntax

Execute(start, size)

Description

Use this method to execute the search query on the search engine. The Execute method returns search results beginning at the document number specified by start, and returns a maximum number of results specified by size.

The Execute method uses the following SearchQuery class properties:

Note. This is an abstract method.

Parameters

start

Specifies an integer representing the first document of the returned results. This parameter must be greater than or equal to 1.

If start exceeds the total number of documents in the index or the search engine-specified maximum number of results, then zero results are returned.

size

Specifies the maximum size of the result set as an integer. This parameter should be greater than or equal to 1.

If size is set to 0, then 10 documents are returned.

Returns

A SearchResultCollection object.

Example

import PT_SEARCH:SearchFactory; import PT_SEARCH:SearchQueryService; import PT_SEARCH:SearchQuery; import PT_SEARCH:SearchResultCollection; /* Instantiate the SearchQuery object */ Local PT_SEARCH:SearchFactory &factory = create PT_SEARCH:SearchFactory(); Local PT_SEARCH:SearchQueryService &svc = &factory.CreateQueryService("default"); Local PT_SEARCH:SearchQuery &srchQuery = &svc.CreateQuery(); /* Initialize the search query */ &srchQuery.QueryText = "some text"; &srchQuery.Language = &lang_cd; &srchQuery.MarkDuplicates = False; &srchQuery.RemoveDuplicates = False; /* Execute the search query */ Local number &start = 1; Local number &size = 10; Local PT_SEARCH:SearchResultCollection &results = &srchQuery.Execute(&start,⇒ &size); /* Re-execute the search query to return the next 10 results */ &start = &start + &size; &results = &srchQuery.Execute(&start, &size);

See Also

Categories, Language, QueryText.

SearchResultCollection Class

Click to jump to top of pageClick to jump to parent topicFormatDateFilter

Syntax

FormatDateFilter(datefilter)

Description

Use this method to convert dates from the internal PeopleSoft date format into a search engine-specific format. You must use this method when the query string is programmatically created.

Note. This is an abstract method.

Parameters

datefilter

Specifies the search filter as a Date value.

Returns

A String value.

See Also

setDateFilter

Click to jump to top of pageClick to jump to parent topicFormatDateTimeFilter

Syntax

FormatDateTimeFilter(datetmfilter)

Description

Use this method to convert dates from the internal PeopleSoft date/time format into a search engine-specific format. You must use this method when the query string is programmatically created.

Note. This is an abstract method.

Parameters

datetmfilter

Specifies the search filter as a DateTime value.

Returns

A String value.

See Also

setDateTimeFilter

Click to jump to parent topicSearchQuery Class Properties

In this section, the SearchQuery class properties are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicCategories

Description

Use this property to set or return the list of search categories (search indexes) you want to search as an array of SearchCategory objects. If this property is defined, the Execute method will run the query on all the search categories specified in this property.

Important! If this property is undefined, the query will be executed against all search categories in the search engine instance.

This property is read-write.

Example

The following example uses two search categories called cat1 and cat2.

import PT_SEARCH:SearchCategory; Local array of PT_SEARCH:SearchCategory &cats; &cats = CreateArray(create PT_SEARCH:SearchCategory("cat1")); &cats.Push(create PT_SEARCH:SearchCategory("cat2")); &searchQuery.Categories = &cats;

See Also

SearchCategory Class

Click to jump to top of pageClick to jump to parent topicContainsAnyWords

Description

Use this property to set a search string that contains one or more words. The search results include those documents that contain any of these words and whatever is defined by other search text properties (for example, ContainsExactPhrase, QueryText, or WithoutWords).

This property is not required.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicContainsExactPhrase

Description

Use this property to set a search string that contains one or more words. The search results include those documents that this exact phrase and whatever is defined by other search text properties (for example, ContainsAnyWords, QueryText, or WithoutWords).

This property is not required.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicClusteringSpecs

Description

This property is reserved for future use.

Click to jump to top of pageClick to jump to parent topicDocsRequested

Description

Use this property to set or return the size of the result set as an integer. After invoking the Execute method, use this property to return the value of the size parameter passed to Execute. Alternatively, if the search query is to be executed by the ExecuteQuery method of the QueryService class, then use this property to specify the size of the result set.

Example

For example, one could compare DocsRequested to the GetDocumentCount method of the ResultCollection class to determine if there are possibly more documents to be retrieved.

The StartIndex and DocsRequested properties (that is, the start and size parameters to the Execute method) allow for “chunking” of search results. The idea is to repeatedly call Execute while increasing the start parameter by the increment specified by size. For example, the following psuedo-code will return the first 100 results the first time through the loop. The second time through the loop, it will return documents 101 through 200, and so on.

int start=1, size=100 ,.// return results in chunks of 100 documents while not done results = query.execute(start, size) if (results.GetDocumentCount() < query.DocsRequested) done = true // we got fewer documents than we asked for so we're done executing this ⇒ // query if (results.GetDocumentCount() = 0) done = true // no more documents being returned so we're done executing this query // do something with the results start = start + size end-while

See Also

Execute, StartIndex.

GetDocumentCount

Click to jump to top of pageClick to jump to parent topicEnableExtendedFilterOperators

Description

Use this property to set or return a Boolean value indicating whether to enable the set of extended filter operators (specifically, the notequals operator). In addition, when this property is set to True, all search filters are added to the QuerytText property and sent to the search engine in this manner. Otherwise, when this property is set to False, the search filters are handled by the Filters property as an array of SearchFilter objects. The default value is False.

This property is not required.

This property is read-write.

See Also

Operator

Click to jump to top of pageClick to jump to parent topicFacetFilters

Description

Use this property to set or return an array of FacetFilter objects on which the search results are currently filtered.

Note. The SearchCategory class GetFacetFilters method can be used to get the initial list of facet filters.

This property is not required.

This property is read-write.

See Also

FacetFilter Class

GetFacetFilters

Click to jump to top of pageClick to jump to parent topicFilterConnector

Description

Use this property to set or return a search filter connector as a string. A search filter connector is used to join search filters. The acceptable values are: AND and OR. The default value is AND.

This property is not required.

This property is read-write.

See Also

Filters

SearchFilter Class

Click to jump to top of pageClick to jump to parent topicFilters

Description

Use this property to set or return the list of search filters as an array of SearchFilter objects.

This property is not required.

This property is read-write.

See Also

FilterConnector

SearchFilter Class

Click to jump to top of pageClick to jump to parent topicGroupingSpec

Description

This property is reserved for future use.

Click to jump to top of pageClick to jump to parent topicLanguage

Description

Use this property to set or return a three-character string representing the language code to which the search query results should be restricted. This property must be a PeopleSoft language code—for example, ENG for English, FRA for French, and so on.

Note. If no value is specified, the query will be executed against all languages.

This property is read-write.

Example

&SearchQuery.Language = "ENG";

See Also

Selecting Database Character Sets

Click to jump to top of pageClick to jump to parent topicMarkDuplicates

Description

Use this property to set or return a Boolean value indicating whether duplicates in the result set should be marked as such. A search result can be identified by running the isDuplicate method.

This property is not required. However, it defaults to False if no value is specified.

This property is read-write.

See Also

RemoveDuplicates

IsDuplicate

Click to jump to top of pageClick to jump to parent topicMaximumNumberOfFacetValues

Description

Use this property to set or return an Integer value representing the maximum number of child facet nodes. For example, if there are 100 facet values, setting this property to 10 will return the first ten facet values as determined by the sorting order. If this property is not set, the default value is -1, which indicates to return all child nodes.

This property is not required.

This property is read-write.

See Also

FacetNode Class

Click to jump to top of pageClick to jump to parent topicMinmumDocumentsPerFacetValue

Description

Use this property to set or return an Integer value representing the minimum number of documents required for the child facet node to be returned. Child facet nodes with less than this document count are not returned. If this property is not set, the default value is 1, which indicates that a facet node must have at least one document to be returned.

This property is not required.

This property is read-write.

See Also

DocumentCount

Click to jump to top of pageClick to jump to parent topicProgrammaticSearchString

Description

Use this property to set or return the programmatically generated search string as a string. This search string is not displayed to the end user.

This property is not required.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicQueryText

Description

Use this property to set or return a string representing the text to use in the search query. The search results include those documents that contain this text and whatever is defined by other search text properties (for example, ContainsAnyWords, ContainsExactPhrase, or WithoutWords).

Note. If no value is specified and none of the other search text properties are defined, then all documents in the index are returned.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicRemoveDuplicates

Description

Use this property to set or return a Boolean value indicating whether duplicates should be removed from the result set.

This property is not required. However, it defaults to False if no value is specified.

This property is read-write.

See Also

MarkDuplicates

Click to jump to top of pageClick to jump to parent topicRequestedFields

Description

Use this property to set or return the list of custom attributes to be included for each search result. The list is an array of SearchField objects.

This property is not required.

This property is read-write.

See Also

GetRequestedFields

SearchField Class

Click to jump to top of pageClick to jump to parent topicReturnFacetValueCounts

Description

Use this property to set or return a Boolean value indicating whether to compute and return document counts per facet node.

This property is not required. However, it defaults to True if no value is specified.

This property is read-write.

See Also

DocumentCount

Click to jump to top of pageClick to jump to parent topicSearchWithIn

Description

Use this property to set or return a string of search terms as a string. This is used to search within the current results.

This property is not required.

This property is read-write.

Click to jump to top of pageClick to jump to parent topicSortFacetValuesBy

Description

Use this property to set or return a String value indicating the sort order by which facet nodes are sorted:

Value

Description

ALPHA_ASC

Sort by node name alphabetically ascending.

ALPHA_DES

Sort by node name alphabetically descending.

COUNT_ASC

Sort by document count numerically ascending.

COUNT_DES

Sort by document count numerically descending.

COUNT_DES is the default value, which means that facet nodes with highest document count are displayed first in the list.

This property is not required.

This property is read-write.

See Also

DocumentCount

Click to jump to top of pageClick to jump to parent topicSortSpecs

Description

This property is reserved for future use.

Click to jump to top of pageClick to jump to parent topicStartIndex

Description

Use this property to set or return an integer representing the first document of the result set. After invoking the Execute method, use this property to return the value of the start parameter passed to Execute. Alternatively, if the search query is to be executed by the ExecuteQuery method of the QueryService class, then use this property to specify the first document of the result set.

See Also

Execute, DocsRequested.

Click to jump to top of pageClick to jump to parent topicTopN

Description

This is reserved for future use.

Click to jump to top of pageClick to jump to parent topicWithoutWords

Description

Use this property to set a search string that contains one or more words. The search results include those documents that do not include any of these words and whatever is defined by other search text properties (for example, ContainsAnyWords, ContainsExactPhrase, or QueryText).

This property is not required.

This property is read-write.

Click to jump to parent topicSearchQueryService Class

This section provides an overview of the SearchQueryService class and discusses: SearchQueryService class methods.

The SearchQueryService provides the ability to instantiate a SearchQuery object along with other interfaces. Because the SearchQueryService class is an interface class, it requires a search engine-specific search query service and search query class to instantiate a search engine-specific SearchQuery object.

A SearchQueryService object is created by the CreateQueryService method of the SearchFactory class.

See Also

CreateQueryService

Click to jump to parent topicSearchQueryService Class Methods

In this section, the SearchQueryService class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicCreateQuery

Syntax

CreateQuery()

Description

Use this method to instantiate a SearchQuery object.

Note. This is an abstract method.

Parameters

None.

Returns

A SearchQuery object.

See Also

SearchQuery Class

Click to jump to top of pageClick to jump to parent topicExecuteQuery

Syntax

ExecuteQuery(&query)

Description

Use this method to execute the specified search query on the search provider and return the collection of search results. This method is equivalent to invoking the Execute method of the SearchQuery class.

Note. This is an abstract method.

Parameters

&query

Specifies the search query as a SearchQuery object.

Returns

A SearchResultCollection object.

See Also

SearchQuery Class, Execute.

SearchResultCollection Class

Click to jump to parent topicSearchResult Class

This section provides an overview of the SearchResult class and discusses: SearchResult class methods

The SearchResult object represents a specific search result (that is, a document) in a SearchResultCollection object. Because the SearchResult class is a generic interface class, a search engine-specific subclass is required. The SearchResult object is defined to comprise 10 standard attributes (or “properties”)—for example, title, URL, summary, and so on. These private, read-only “properties” can be accessed only through the methods of the SearchResult class.

A SearchResult object is instantiated by the First, Item or Next methods of the SearchResultCollection.

See Also

SearchResultCollection Class

Click to jump to parent topicSearchResult Class Methods

In this section, the SearchResult class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicGetCategoryNames

Syntax

GetCategoryNames()

Description

Use this method to return the list of search categories to which this search result belongs as an array of string.

Parameters

None.

Returns

An array of string.

See Also

SearchCategory Class

Click to jump to top of pageClick to jump to parent topicGetContentLength

Syntax

GetContentLength()

Description

Use this method to return the content length for this search result as an integer. If the content length cannot be determined, this method returns -1.

The content length, signature, title, and other attributes are used to determine whether a search result is a duplicate.

Parameters

None.

Returns

An integer.

See Also

IsDuplicate

Click to jump to top of pageClick to jump to parent topicGetCustomAttributes

Syntax

GetCustomAttributes()

Description

Use this method to return a SearchFieldCollection representing the custom attributes for this search result. A SearchFieldCollection is a collection of SearchField objects.

Parameters

None.

Returns

A SearchFieldCollection object.

See Also

SearchFieldCollection Class

SearchField Class

Click to jump to top of pageClick to jump to parent topicGetLanguage

Syntax

GetLanguage()

Description

Use this method to return a string representing the three-character PeopleSoft language code for this search result.

Parameters

None.

Returns

A string.

See Also

Language

Click to jump to top of pageClick to jump to parent topicGetLastModified

Syntax

GetLastModified()

Description

Use this method to return the last modified date and time for this search result.

Parameters

None.

Returns

A DateTime value.

Click to jump to top of pageClick to jump to parent topicGetScore

Syntax

GetScore()

Description

Use this method to return the search engine-specific score for this search result as an integer.

Parameters

None.

Returns

An integer.

Click to jump to top of pageClick to jump to parent topicGetSignature

Syntax

GetSignature()

Description

Use this method to return the search engine-computed signature for this search result as an integer. If the signature cannot be determined, this method returns -1.

The signature, content length, title, and other attributes are used to determine whether a search result is a duplicate.

Parameters

None.

Returns

An integer.

See Also

IsDuplicate

Click to jump to top of pageClick to jump to parent topicGetSummary

Syntax

GetSummary()

Description

Use this method to return the summary for this search result as a string.

Parameters

None.

Returns

A string.

Click to jump to top of pageClick to jump to parent topicGetTitle

Syntax

GetTitle()

Description

Use this method to return the title for this search result as a string.

Parameters

None.

Returns

A string.

Click to jump to top of pageClick to jump to parent topicGetUrlLink

Syntax

GetUrlLink()

Description

Use this method to return the URL for this search result as a string.

Parameters

None.

Returns

A string.

Click to jump to top of pageClick to jump to parent topicHasDuplicate

Syntax

HasDuplicate()

Description

Use this method to return a Boolean value indicating whether this search result has duplicates.

Parameters

None.

Returns

A Boolean value: True if the search result has duplicates, False otherwise.

See Also

IsDuplicate

MarkDuplicates

Click to jump to top of pageClick to jump to parent topicIsDuplicate

Syntax

IsDuplicate()

Description

Use this method to return a Boolean value indicating whether this search result is a duplicate. Exact duplicates and near duplicates are both marked as duplicates by the PeopleSoft Search Framework.

An exact duplicate is a document that satisfies all of the following conditions exactly:

A near duplicate (a similar document) is a document that satisfies any of the following conditions:

Parameters

None.

Returns

A Boolean value: True if this search result is a duplicate, False otherwise.

See Also

GetContentLength, GetSignature, GetTitle, GetUrlLink, HasDuplicate.

MarkDuplicates

Click to jump to parent topicSearchResultCollection Class

This section provides an overview of the SearchResultCollection class and discusses: SearchResultCollection class methods.

The SearchResultCollection class provides a collection of SearchResult objects. Because the SearchResultCollection class is a generic interface class, a search engine-specific subclass is required. A SearchResultCollection object is returned by the Execute method of the SearchQuery class.

See Also

Execute

Click to jump to parent topicSearchResultCollection Class Methods

In this section, the SearchResultCollection class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicFirst

Syntax

First()

Description

Use this method to return the first SearchResult object in the SearchResult collection. If the SearchResult collection is empty, it returns Null.

Parameters

None.

Returns

A SearchResult object if successful, Null otherwise.

See Also

SearchResult Class

Click to jump to top of pageClick to jump to parent topicGetDocumentCount

Syntax

GetDocumentCount()

Description

Use this method to return the actual number of SearchResult objects (documents) in the SearchResult collection.

Note. This is an abstract method.

Parameters

None.

Returns

An integer.

See Also

DocsRequested

Click to jump to top of pageClick to jump to parent topicGetDuplicatesMarked

Syntax

GetDuplicatesMarked()

Description

Use this method to return a Boolean value indicating whether duplicate items in the collection are marked as duplicates—that is, whether the search query was executed with MarkDuplicates set to true.

Note. This is an abstract method.

Parameters

None.

Returns

A Boolean value: True if duplicates were marked, False otherwise.

See Also

MarkDuplicates

IsDuplicate

Click to jump to top of pageClick to jump to parent topicGetDuplicatesRemoved

Syntax

GetDuplicatesRemoved()

Description

Use this method to return a Boolean value indicating whether duplicate items in the collection were removed—that is, whether the search query was executed with RemoveDuplicates set to true.

Note. This is an abstract method.

Parameters

None.

Returns

A Boolean value: True if duplicates were removed, False otherwise.

See Also

RemoveDuplicates, IsDuplicate.

Click to jump to top of pageClick to jump to parent topicGetEstimatedHitCount

Syntax

GetEstimatedHitCount()

Description

Use this method to return the estimated hit count for the search query as an integer. The estimated hit count can be used as a device for fetching search results on demand rather than retrieving all of the search results initially.

Note. This is an abstract method.

Parameters

None.

Returns

An integer.

Click to jump to top of pageClick to jump to parent topicGetFacetNodes

Syntax

GetFacetNodes()

Description

Use this method to return an array of facet nodes available for this search result collection.

Parameters

None.

Returns

An array of FacetNode objects if successful, Null otherwise.

See Also

FacetNode Class

Click to jump to top of pageClick to jump to parent topicGetQueryObject

Syntax

GetQueryObject()

Description

Use this method to return the SearchQuery object that was used for the search.

Parameters

None.

Returns

A SearchQuery object.

See Also

SearchQuery Class

Click to jump to top of pageClick to jump to parent topicGetQueryText

Syntax

GetQueryText()

Description

Use this method to return the search text that was used for the search query as a string.

Note. This is an abstract method.

Parameters

None.

Returns

A string.

See Also

QueryText

Click to jump to top of pageClick to jump to parent topicGetStartIndex

Syntax

GetStartIndex()

Description

Use this method to return the value of the &start parameter that was used to execute this search query.

Note. This is an abstract method.

Parameters

None.

Returns

An integer.

See Also

Execute, StartIndex.

Click to jump to top of pageClick to jump to parent topicItem

Syntax

Item(index)

Description

Use this method to return the SearchResult object at the position in the SearchResult collection specified by the index parameter.

Parameters

index

Specifies the position of the SearchResult object in the SearchResult collection as an integer.

Returns

A SearchResult object if successful, Null otherwise.

See Also

SearchResult Class

Click to jump to top of pageClick to jump to parent topicNext

Syntax

Next()

Description

Use this method to return the next SearchResult object in the SearchResult collection. This method can only be invoked after a successful invocation of the First, Item, or Next methods.

Parameters

None.

Returns

A SearchResult object if successful, Null otherwise.

See Also

First, Item.

SearchResult Class

Click to jump to parent topicSearchAuthnQueryFilter Class

This section provides an overview of the SearchAuthnQueryFilter class and discusses: SearchAuthnQueryFilter class methods.

The SearchAuthnQueryFilter class provides an abstract method to evaluate a list of values for a security attribute for a given search user. An application that requires document-level security in a searchable object must implement and extend the evaluateAttrValues abstract method.

Click to jump to parent topicSearchAuthnQueryFilter Class Methods

In this section, the SearchAuthnQueryFilter class methods are presented in alphabetical order.

Click to jump to top of pageClick to jump to parent topicevaluateAttrValues

Syntax

evaluateAttrValues(SBO_name, attr, user_ID)

Description

Use this method to return a list of values for a security attribute for a search user.

Note. This is an abstract method.

Parameters

SBO_name

Specifies a string representing a searchable object upon which the security attribute value needs to be evaluated

attr

Specifies a string representing the security attribute value as a document-level filtering attribute.

user_ID

Specifies user ID that executed the search query as a string.

Returns

An array of string.

Example

import PTSF_SECURITY:*; class UserPermission implements PTSF_SECURITY:SearchAuthnQueryFilter method UserPermissionList(); method evaluateAttrValues(&sboName As string, &secAttr As string, &searchUser⇒ As string) Returns array of string; end-class; method UserPermissionList end-method; method evaluateAttrValues /+ &sboName as String, +/ /+ &secAttr as String, +/ /+ &searchUser as String +/ /+ Returns Array of String +/ /+ Extends/implements PTSF_SECURITY:SearchAuthnQueryFilter.evaluateAttrValues +/ Local SQL &userPermissions_SQL; Local array of string &retvalues; Local string &isAdmin; &retvalues = CreateArrayRept("", 0); SQLExec("SELECT 'X' FROM PSROLEUSER WHERE ROLEUSER=:1 AND (ROLENAME=:2 OR⇒ ROLENAME=:3)", &searchUser, "Portal Administrator", "PeopleSoft Administrator",⇒ &isAdmin); If All(&isAdmin) Then &retvalues = CreateArray("R:Admin"); Else &retvalues.Push("0"); /* Public */ &retvalues.Push("1:" | &searchUser); /* Author */ &userPermissions_SQL = CreateSQL("SELECT DISTINCT A.CLASSID FROM PSROLECLASS⇒ A, PSROLEUSER B, PSOPRDEFN C WHERE A.ROLENAME = B.ROLENAME AND C.OPRID =⇒ B.ROLEUSER AND C.OPRID = :1", &searchUser); Local string &classids; While &userPermissions_SQL.Fetch(&classids) &retvalues.Push(&classids); End-While; End-If; Return &retvalues; end-method;

Click to jump to parent topicAdditional Search Examples

This section provides additional code examples for the PeopleSoft Search Framework:

Click to jump to top of pageClick to jump to parent topicSearching Using Facets

The following provides an example of searching using facets.

import PT_SEARCH:*; /* The following 3 lines are same for any implementation */ Local PT_SEARCH:SearchFactory &factory = create PT_SEARCH:SearchFactory(); Local PT_SEARCH:SearchQueryService &svc = &factory.CreateQueryService("default"); Local PT_SEARCH:SearchQuery &qry = &svc.CreateQuery(); /* This is the keywords user is searching for; */ &qry.QueryText = "a"; /* &qry.StartIndex , For the first request this is always 1 When using pagination to get the next set of results this can be changed to ⇒ DocsRequested + StartIndex ex: here 51 on next request is 101.. The maximum number of results that can come back is 200 which is configurable ⇒ at SES the max results for this query can be fetched from SearchResultCollection ⇒ hit count */ &qry.StartIndex = 1; /* &qry.DocsRequested , Number of results to be returned by the search , It is ⇒ recommended to keep this default to 50 for performance reasons and show 10 ⇒ results per page and if the end user is requesting for 6th page request with ⇒ start index to 51; */ &qry.DocsRequested = 50; /* &qry.RemoveDuplicates ,&qry.MarkDuplicates Currently these two should always be ⇒ set to false as our we generate unique id for every search document. &qry.RemoveDuplicates = False; */ &qry.MarkDuplicates = False; /* This should be set to empty value to search in documents from all languages . &qry.Language This can be provided a value to search in language specific documents Currently the frame work does not allow searching in selected languages , its ⇒ either all or one language */ &qry.Language = %Language_User; /* &qry.Categories , Array of categories on which the search can be performed on If not specified we will search in all categories */ Local PT_SEARCH:SearchCategory &srchCat = create PT_SEARCH:SearchCategory("MY_SRCH_⇒ CAT"); &qry.Categories = CreateArray(&srchCat); /* &qry.RequestedFields , Array of custom attribute values in the search result Optional , if not specified all the standard information like URL , body , title ⇒ are still returned */ &qry.RequestedFields = &srchCat.GetRequestedFields(); /* &qry.FacetFilters , Array of facets filter the search result by Optional , If not specified No facets will be returned Limitation : Only documents having this facet and path (If included) will be ⇒ returned in the search result. FacetFilter constructor will take two arguments 1.Facet name , 2.Facet Path FacetFilter is required when dealing with hierarchy facets Ex: Attribute LOCATION ⇒ has COUNTRY/STATE/CITY To filter results for country USA the request will be FacetName: LOCATION , Facet ⇒ Filter: USA To filter results for country USA and State CA the request will be FacetName: ⇒ LOCATION , FacetFilter: USA/CA &qry.FacetFilters = CreateArray(create PT_SEARCH:FacetFilter("SETID", "")); &qry.FacetFilters.Push(create PT_SEARCH:FacetFilter("STATE", "")); */ &qry.FacetFilters = &srchCat.GetFacetFilters(); /* The other optional facet request related query parameters that can be set when ⇒ searching for facets ReturnFacetValueCounts -- returns the counts only if this is set to true , ⇒ default is true , set this to false if we do not want to display counts. MinmumDocumentsPerFacetValue -- only return facet value whose document hit count ⇒ is more that this , ex: only facets values which have hit count more than 5 or 1; MaximumNumberOfFacetValues -- the children facets can be huge list , this can ⇒ limit the return list SortFacetValuesBy -- ALPHA_DES , ALPHA_ASC , COUNT_DES , COUNT_ASC the max fetch returns the only top few children this can be used to provide ⇒ which top children to return */ /* Execute the query and get back the results */ Local PT_SEARCH:SearchResultCollection &res = &qry.Execute(&qry.StartIndex, ⇒ &qry.DocsRequested); /* Find the number of results returned by the search , this will always be less than ⇒ or equal to "&qry.DocsRequested" */ Local integer &resultSize = &res.GetDocumentCount(); /* Find the number of potential results that can be returned; This can be used to determine if we get the next set of results and how many ⇒ pages that can be shown to the user */ Local integer &estmatedResultCount = &res.GetEstimatedHitCount(); Local string &outHtml; /* FacetNode will have the facet values and the hit count for the results GetFacetNodes will return array of the facet nodes in the result */ Local array of PT_SEARCH:FacetNode &facetNodes = &res.GetFacetNodes(); /* Facet Node has various information which can be retrieved. &facetNodes [&i].DocumentCount will return hit count &facetNodes [&j].FacetValue , is the facet value before translation &facetNodes [&i].DisplayValue , translated facet value (currently this is not yet ⇒ supported by SES) &facetNodes [&i].Path , to which the facet value belongs to &facetNodes [&i].getChildNodes() will return child facet nodes and will have all ⇒ above properties */ /* loop through facet nodes and there children and render it in the UI */ If &facetNodes <> Null And &facetNodes.Len <> 0 Then &outHtml = &outHtml | "<table border='1'><tr><th>Name</th><th>Value⇒ </th><th>DisplayValue</th><th>DocCount</th><th>Path</th><th></th></tr>"; For &i = 1 To &facetNodes.Len &outHtml = &outHtml | "<tr><td>" | &facetNodes [&i].FacetName | "</td>⇒ <td>" | &facetNodes [&i].FacetValue | "</td><td>"; &outHtml = &outHtml | &facetNodes [&i].DisplayValue | "</td><td>"; &outHtml = &outHtml | &facetNodes [&i].DocumentCount | "</td><td>" | ⇒ &facetNodes [&i].Path | "</td></tr>"; If &facetNodes [&i].HasChildren Then &outHtml = &outHtml | "<tr><th>Child</th><th>Name</th><th>Value⇒ </th><th>DisplayValue</th><th>DocCount</th><th>Path</th></tr>"; Local array of PT_SEARCH:FacetNode &childFacetNodes = &facetNodes ⇒ [&i].getChildNodes(); For &j = 1 To &childFacetNodes.Len &outHtml = &outHtml | "<tr><td></td><td>" | &childFacetNodes ⇒ [&j].FacetName | "</td><td>" | &childFacetNodes [&j].FacetValue; &outHtml = &outHtml | "</td><td>" | &childFacetNodes [&j].DisplayValue; &outHtml = &outHtml | "</td><td>" | &childFacetNodes [&j].⇒ DocumentCount | "</td><td>" | &childFacetNodes [&j].Path | "</td></tr>"; End-For; End-If; End-For; &outHtml = &outHtml | "</table>"; Else &outHtml = &outHtml | "<br><bold>No Facet Nodes</bold>"; End-If; /* &res.Item(&i) returns a PT_SEARCH:SearchResult for each search result document ⇒ which has various information which can be retrieved for display purposes &srchResult.GetUrlLink , returns the URL which can take the user to the ⇒ transaction page &srchResult.GetTitle , returns the Title for the search result document &srchResult.GetSummary , returns the body for the search result document &srchResult.GetScore , returns the score for the search result document &srchResult.GetCategoryNames , returns the search categories this search result ⇒ document belongs too &srchResult.GetCustomAttributes , will return a SearchFieldCollection which has ⇒ custom search attribute values */ /* loop through each result and render it in the UI */ Local PT_SEARCH:SearchResult &srchResult; For &i = 1 To &resultSize &srchResult = &res.Item(&i); &outHtml = &outHtml | "<font size=""2""><hr/>Title: <a href="" " | ⇒ &srchResult.GetUrlLink() | """>" | &srchResult.GetTitle() | "</a>"; rem &outHtml= &outHtml| ""; &outHtml = &outHtml | "<br>Summary: " | &srchResult.GetSummary(); &outHtml = &outHtml | "<br>Score: " | &srchResult.GetScore(); &outHtml = &outHtml | " Source Group: "; If Not &srchResult.GetCategoryNames() = Null Then For &j = 1 To &srchResult.GetCategoryNames().Len &outHtml = &outHtml | " " | &srchResult.GetCategoryNames()[&j]; End-For; End-If; &outHtml = &outHtml | "<font size=""2"" color=#009933><br>Url: " | ⇒ &srchResult.GetUrlLink() | "</font>"; &outHtml = &outHtml | "<font size=""2"" color=#097054><br>Signature: " | ⇒ &srchResult.GetSignature() | "</font>"; &outHtml = &outHtml | "<font size=""2"" color=#097054> / Content Length: " ⇒ | &srchResult.GetContentLength() | "</font>"; &outHtml = &outHtml | "<font size=""2"" color=#097054> / Language: " | ⇒ &srchResult.GetLanguage() | "</font>"; &outHtml = &outHtml | "<font size=""2"" color=#000000><br>Last Modified: " ⇒ | &srchResult.GetLastModified() | "</font>"; Local PT_SEARCH:SearchFieldCollection &customs = &srchResult.⇒ GetCustomAttributes(); If (&customs <> Null) Then For &j = 1 To &customs.Count() &outHtml = &outHtml | "<br>" | &customs.Item(&j).Name | "=" | ⇒ &customs.Item(&j).Value; End-For; End-If; &outHtml = &outHtml | "</font>"; End-For; &outHtml = &outHtml | "</BODY></HTML>";