SearchQuery Class Methods

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

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.

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:

  • Categories

    Note: If this property is undefined, the query will be executed against all search categories.

  • Language

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

  • QueryText

    Note: If no value is specified, then all documents in the index are returned.

Note: This is an abstract method.

Parameters

Field or Control

Definition

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);

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

Field or Control

Definition

datefilter

Specifies the search filter as a Date value.

Returns

A String value.

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

Field or Control

Definition

datetmfilter

Specifies the search filter as a DateTime value.

Returns

A String value.