Toggle menu

CSSearchMultiple

The CSSearchMultiple class searches an iCM, site, or custom search collection for the specified search terms or keywords.

This documentation describes the methods and properties available to use via the API Server's iCMAPI Worker. If you are working directly with the iCM.NET or iCM4j APIs, consult the documentation for your framework. The main difference being the various add methods available in the standard APIs, whereas the iCMAPI Worker requires everything to be done via the properties of the get request.

The following search collections are maintained by iCM. For more information about how the items in each collection are indexed see the Search Indexing article.

The Advanced Searching with CSSearchMultiple knowledge base articles include example forms that demonstrate faceting, grouping and location based searches. They use filter queries, group queries, SOLR functions as search commands, and show how additional SOLR parameters can be included in your requests.

CollectionDescriptionInstance
ArticleThe articles in iCMSite and iCM
MediaItems in the iCM media librarySite and iCM
MessageReplies to forum threadsSite and iCM
MetadataMetadata values in iCMSite and iCM
ObjectiCM objectsSite and iCM
ProductProducts in the iCM commerce platformSite and iCM
PublishedEndpointPublished End PointsiCM only
PublishedFormPublished FormsiCM only
SiteUserWebsite usersSite and iCM
WIPEndpointWork in progress End pointsiCM only
WIPFormWork in progress formsiCM only

For user-defined collections, search results will depend on the information contained within the collection. The key information inserted for each item within the user-defined collection must be in the format <Item ID>_<Item Type>, where 'Item ID' is the item's unique identifier and 'Item Type' is the label that identifies the item's type.

Methods

CSSearchMultiple_get

Performs the search. Due to the wide range of properties that can be used to restrict/refine the search, they won't all be repeated here, just those that are required are listed, followed by some examples. See the relevant knowledge base articles for more detailed examples.

Request Parameters

NameTypeDescription
set.CollectionNameListString, requiredA comma separated list of the collections you'd like to search. Not all collections are available in the solrsite collection (see above). * searches all
set.LuceneRepositoryPathString, requiredThe path to the SOLR collection
set.KeywordsStringA comma separated list of keywords to search for. The default operator OR is used (can be changed using the KeywordOperator property). Either Keywords or SearchCommand must be set
set.SearchCommandStringThe search command to pass directly to SOLR. Useful if constructing more complex (eg function) searches. By default ignores other properties that restrict the search (behaviour can be changed using the SearchCommandAction property). Either Keywords or SearchCommand must be set
get.[property,property]StringA comma separated list of the properties of CSSearchMultiple you would like to get. * returns all. See below

Keywords

The Keywords property searches the collection for a space delimited set of keywords. The default operator is OR. Round brackets can be used to group keywords. Double-quotes can be used to wrap a keyword or set of keywords indicating that they should be treated as an exact phrase. Searching is case-insensitive, meaning that a keyword of Film will match against film, Film and FILM.

By default stemming is enabled, so a keyword of film will return film, films, filming, etc. Double quotation marks can be used to wrap an individual keyword if stemming is not required in that particular instance. Stemming can be turned off completely by setting the KeywordStemming property to false.

SearchCommand

The SearchCommand property overrides the keywords property and can be used to construct complex queries where the default properties do not meet your requirements. The search command is passed directly to the SOLR engine. Using SearchCommand ignores other properties that may restrict the search, like root groups and IDs or subsite restrictions. It's possible to retain some content restrictions using the SearchCommandAction property (see below).

Example Request - Return All

In this request we are searching the solrsite article collection for any articles with the word Tim in. You need to request all if you want the information in each CSSearchItem to be returned.

client.invoke("icmapi", "CSSearchMultiple_get", {
    "set": {
        "CollectionNameList": "Article",
        "LuceneRepositoryPath": "http://localhost:5506/solrsite",
        "Keywords": "Tim"
    },
    "get": "*"
});

Response Properties

NameTypeDescription
data.multipleItemDataArrayAn array of CSSearchItems matching the properties of the get request
data.itemDataObjectThe properties of the get request, including faceting results

Example Response - Return All

Two results have been found.

"result": {
    "data": {
        "multipleItemData": [{
            "ParentData": ",154,1,0",
            "CreationDate": "2018-02-14T10:42:19Z",
            "_ItemClass": "CSSearchItem",
            "GroupKey": "Article154",
            "Title": "Tim's Article",
            "Url": "",
            "Custom3": "1",
            "Score": 17.848412,
            "Type": "Article",
            "Custom2": "",
            "Custom1": ",154,1,0",
            "ModificationDate": "2018-02-14T10:42:19Z",
            "MetaData": "",
            "DynamicFields": {
                "OBJECT_C__title": "Tim's Article"
            },
            "Summary": "This is the summary text This is the body text",
            "Key": "154"
        }, {
            "ParentData": ",155,1,0",
            "CreationDate": "2018-02-14T10:42:54Z",
            "_ItemClass": "CSSearchItem",
            "GroupKey": "Article155",
            "Title": "Tim's Article with Metadata",
            "Url": "",
            "Custom3": "1",
            "Score": 14.278729,
            "Type": "Article",
            "Custom2": "1",
            "Custom1": ",155,1,0",
            "ModificationDate": "2018-02-14T10:42:54Z",
            "MetaData": "1",
            "DynamicFields": {
                "OBJECT_C__title": "Tim's Article with Metadata"
            },
            "Summary": "This is the summary text This is the body text",
            "Key": "155"
        }],
        "itemData": {
            "SearchHandler": "",
            "EnableDidYouMean": false,
            "KeywordOROperators": "",
            "_ItemClass": "CSSearchMultiple",
            "Server": null,
            "GroupQueries": [],
            "GroupField": "",
            "Port": 0,
            "LuceneRepositoryPath": "http://localhost:5506/solricm",
            "GroupTruncate": false,
            "RootArticleIDs": "",
            "FacetDateStart": "NOW/YEAR",
            "MediaGroupNames": "",
            "MediaTypeNames": "",
            "RootProductGroupIDs": "",
            "CollectionNameList": "Article",
            "GroupList": "",
            "CachingEnabled": false,
            "FieldFacets": {},
            "SolrPageSize": 500,
            "QueryFacets": {},
            "SolrResultCount": 2,
            "LastModifiedEndDate": null,
            "FacetFieldPrefix": "",
            "DatabaseVersion": 10.0006,
            "MediaMetaDataOptionalIDs": "",
            "FacetQueries": [],
            "SolrStartPosition": 0,
            "KeywordNOTOperators": "",
            "Timeout": 5000,
            "MinFacetCount": 1,
            "SolrParameters": [],
            "PropertyFile": "./etc/dbprops.dat",
            "GroupLimit": 2147483647,
            "ApproxTotalResults": 2,
            "LastModifiedStartDate": null,
            "SubsiteID": 0,
            "DetailLevel": 4,
            "SummaryAction": 1,
            "DidYouMean": "",
            "RecordedGatewayMessages": [],
            "MaxRows": 50,
            "UseCache": false,
            "RecordGatewayMessages": false,
            "RootProductRackIDs": "",
            "SearchCommandAction": 0,
            "HighlightingEnabled": false,
            "KeywordStemming": true,
            "Keywords": "Tim",
            "VerityRestartPosition": 1,
            "ClusteringField": "",
            "MaxFacets": 10,
            "DateFacets": {},
            "RootMediaGroupIDs": "",
            "FieldConstraints": [],
            "RootThreadIDs": "",
            "More": false,
            "MediaMetaDataIDs": "",
            "FilterQueries": [],
            "UserID": 0,
            "ArticleMetaDataOptionalIDs": "",
            "FacetFields": [],
            "BoostSearch": true,
            "FacetDateGap": "+1MONTH",
            "CaseSensitive": false,
            "SearchCommand": null,
            "GroupOffset": 0,
            "KeywordANDOperators": "",
            "FacetDateEnd": "NOW",
            "FacetDates": [],
            "KeywordOperator": 1,
            "RootForumIDs": "",
            "Preview": false,
            "SearchEngineRestartPosition": 1,
            "SortOrder": "",
            "StartRow": 1,
            "ArticleMetaDataIDs": "",
            "ColdFusionVersion": 0,
            "FacetParameters": [],
            "UseLuceneCollections": true,
            "DebugOutput": false,
            "DisplayDateCriteria": "(*:* -keytype:Article -keytype:Media) OR (displaystartdate:[* TO \"2018-02-14T10:49:19Z\"] AND displayenddate:{\"2018-02-14T10:49:19Z\" TO *})"
        }
    },
    "success": true
}

Example Request - Limited Properties

In this request we just want the count of results.

client.invoke("icmapi", "CSSearchMultiple_get", {
    "set": {
        "CollectionNameList": "Article",
        "LuceneRepositoryPath": "http://localhost:5506/solrsite",
        "Keywords": "Tim"
    },
    "get": "SolrResultCount"
});

Example Response - Limited Properties

Note how the CSSearchItem details aren't returned when we define properties in the get request.

"result": {
    "data": {
        "multipleItemData": [{
            "_ItemClass": "CSSearchItem"
        }, {
            "_ItemClass": "CSSearchItem"
        }],
        "itemData": {
            "_ItemClass": "CSSearchMultiple",
            "SolrResultCount": 2
        }
    },
    "success": true
}

Date Faceting

You can perform faceting using the get method. The facets will be present in the DateFacets property of the returned itemData.

Note that this method creates facets for the returned results. The results themselves are not filtered or restricted in any way. To apply facets a subsequent request would have to be made, generally adding the facet as a filter query.

For more examples of faceting, see the knowledge base section of this site.

DateMathParser Syntax

Dates can be passed to SOLR in an ISO 8601 format, "2016-06-01T00:00:00Z", or using DateMathParser (opens new window). This syntax lets you set times in the past (-) or future (+) and round (/) to the start of the current unit.

Common strings include:

NOW - The date and time right now
/MONTH - The start of the current month
+1DAY - One day in the future from now
-1YEAR - One year ago from now

Request Parameters

By default only 10 facets are returned. Set MaxFacets to return a different number.

NameTypeDescription
set.CollectionNameListString, requiredA comma separated list of the collections you'd like to search. Not all collections are available in the solrsite collection (see above). * searches all
set.LuceneRepositoryPathString, requiredThe path to the SOLR collection
set.KeywordsStringA comma separated list of keywords to search for. The default operator OR is used (can be changed using the KeywordOperator property). Either Keywords or SearchCommand must be set
set.SearchCommandStringThe search command to pass directly to SOLR. Useful if constructing more complex (eg function) searches. By default ignores other properties that restrict the search (behaviour can be changed using the SearchCommandAction property). Either Keywords or SearchCommand must be set
set.FacetDatesArrayYou can facet on creationdate, modificationdate, etc
set.FacetDateStartStringEither an ISO 8601 combined date-time or a value constructed using DateMathParser syntax
set.FacetDateEndStringEither an ISO 8601 combined date-time or a value constructed using DateMathParser syntax
set.FacetDateGapStringA DateMathParser value for the gap used to group results into facets
get.[property,property]StringA comma separated list of the properties of CSSearchMultiple you would like to get. * returns all

Example Request

This is the same request as above, but with month facets configured between the start of 2016 and now.

client.invoke("icmapi", "CSSearchMultiple_get", {
    "set": {
        "CollectionNameList": "Article",
        "LuceneRepositoryPath": "http://localhost:5506/solricm",
        "Keywords": "Tim",
        "FacetDates": ["creationdate"],
        "FacetDateStart": "2016-01-01T00:00:00Z",
        "FacetDateEnd": "NOW",
        "FacetDateGap": "+1MONTH",
    },
    "get": "SolrResultCount,DateFacets"
});

Response Properties

NameTypeDescription
data.multipleItemDataArrayAn array of CSSearchItems matching the properties of the get request
data.itemDataObjectThe properties of the get request, including faceting results

Example Response

Three results have been found, falling into two months.

"result": {
    "data": {
        "multipleItemData": [{
            "_ItemClass": "CSSearchItem"
        }, {
            "_ItemClass": "CSSearchItem"
        }, {
            "_ItemClass": "CSSearchItem"
        }],
        "itemData": {
            "_ItemClass": "CSSearchMultiple",
            "SolrResultCount": 3,
            "DateFacets": {
                "creationdate": {
                    "2017-01-01T00:00:00Z": 1,
                    "2018-02-01T00:00:00Z": 2
                }
            }
        }
    },
    "success": true
}

Field Faceting

Field facets work in a broadly similar way to date facets, faceting on a property of the returned CSSearchItems, not just the date fields. As with Date Facets, any configured facets are returned in the FieldFacets property of the returned itemData.

Request Parameters

By default only 10 facets are returned. Set MaxFacets to return a different number.

NameTypeDescription
set.CollectionNameListString, requiredA comma separated list of the collections you'd like to search. Not all collections are available in the solrsite collection (see above). * searches all
set.LuceneRepositoryPathString, requiredThe path to the SOLR collection
set.KeywordsStringA comma separated list of keywords to search for. The default operator OR is used (can be changed using the KeywordOperator property). Either Keywords or SearchCommand must be set
set.SearchCommandStringThe search command to pass directly to SOLR. Useful if constructing more complex (eg function) searches. By default ignores other properties that restrict the search (behaviour can be changed using the SearchCommandAction property). Either Keywords or SearchCommand must be set
set.FieldFacetsArrayYou can facet on creationdate, modificationdate, etc
set.FacetFieldPrefixStringYou can optionally restrict the facets returned to those that start with this string
get.[property,property]StringA comma separated list of the properties of CSSearchMultiple you would like to get. * returns all

Example Request

In this example the dynamic OBJECT_RAWC_ field is being used as a facet. This special field is used to preserve the article title which would otherwise have each word broken down into individual tokens.

client.invoke("icmapi", "CSSearchMultiple_get", {
    "set": {
        "CollectionNameList": "Article",
        "LuceneRepositoryPath": "http://localhost:5506/solricm",
        "Keywords": "Tim",
        "FacetFields": ["OBJECT_RAWC__title"]
    },
    "get": "SolrResultCount,FieldFacets"
});

Example Response

Faceting by title probably isn't the best thing to do, as most article titles will be fairly unique. Including "FacetFieldPrefix": "l" with the request would mean only the "latest news" and "locations" facets would be created (all three results would still be returned).

"result": {
    "data": {
        "multipleItemData": [{
            "_ItemClass": "CSSearchItem"
        }, {
            "_ItemClass": "CSSearchItem"
        }, {
            "_ItemClass": "CSSearchItem"
        }],
        "itemData": {
            "_ItemClass": "CSSearchMultiple",
            "FieldFacets": {
                "OBJECT_RAWC__title": {
                    "latest news": 1,
                    "tim's article": 1,
                    "locations": 1
                }
            },
            "SolrResultCount": 3
        }
    },
    "success": true
}

Properties

PropertyTypeDescription
ApproxTotalResultsIntegerThe approximate number of total matching results. The value is approximate as it does not account for the on/off state or security of the items returned. Only accessible content will actually be returned in the search results. SolrResultCount returns a true count of the returned results
ArticleMetaDataIDsStringA string of comma separated metadata value IDs. Only articles that have all of these values related to them will be returned
ArticleMetaDataOptionalIDsStringA string of comma separated metadata value IDs. Only articles that have any one of these values related to them will be returned
BoostSearchBooleanWhether the search should take the "boost value" of an article into account. See Article Search Optimisation for more information. Default: true. Note that the boost property only applies to the solrsite search collection, not solricm
CaseSensitiveBooleanIf true the search (either keyword or command) will be case sensitive. Default: false. Note that keywords or search commands all in uppercase seem to ignore this property
CollectionNameListStringA string of comma separated collection names to search in (Article, Media etc listed above)
DateFacetsObjectThe property in the returned itemData that holds the facet dates (if any)
DidYouMeanStringIf EnableDidYouMean is set as true this property holds the returned suggestion
EnableDidYouMeanBooleanIf set as true, and a search returns no results, the DidYouMean property will return a corrected suggestion. Default: false. This feature only exists for the solrsite collection, not solricm
FacetDateEndStringUsed with FacetDateStart to set the range between which date facets will be created. Either an ISO 8601 combined date-time or a value constructed using DateMathParser syntax. Note this does not limit the search results to this end date. See faceting below for more information. Default: "NOW"
FacetDateGapStringThe interval for date faceting, constructed using DateMathParser syntax. See above for more information. Default: "+1MONTH"
FacetDatesArrayAn array of date properties to facet on eg "modificationdate", "creationdate", "displaystartdate", "displayenddate"
FacetDateStartStringUsed with FacetDateEnd to set the range between which date facets will be created. Either an ISO 8601 combined date-time or a value constructed using DateMathParser syntax. Note this does not limit the search results to this start date. See faceting below for more information. Default: "NOW/YEAR" (the start of the current year)
FacetFieldPrefixStringUsed with FacetFields. Only facets that start with this string will be returned. See above for an example
FacetFieldsArrayAn array of property names from CSSearchItem to facet on. See above for an example
FacetQueriesArrayAn array of facet queries. Used to send more complex facet queries directly to the SOLR engine
FieldFacetsObjectThe property in the returned itemData that holds the facet fields (if any)
FilterQueriesArrayAn array of filter queries. Defines a query that can be used to restrict the superset of items that are returned, like applying facets to the main query. Also used when the SearchCommand contains a SOLR function query
GroupFieldStringA property from CSSearchItem used to group results. Unlike facets which return a list of results and a count of items that match configured facets, grouping groups the results themselves. Generally only makes sense to group by metadata. Cannot be used in conjunction with GroupQueries
GroupLimitIntegerLimit the number of results returned in each group. The NumFound property of CSSearchGroup will still count the full number
GroupListStringA comma separated list of website user group IDs. Set in conjunction with UserID (otherwise serves no purpose)
GroupOffsetIntegerIf limiting the number of results returned per group, the number of results to skip. For example, should a group have 20 results, and you are limiting the results to four, an offset of 1 would display results 2-5, an offset of 4 results 5-8 etc
GroupQueriesArrayAn array of group queries. Cannot be used in conjunction with GroupField. Used to send more complex group queries directly to the SOLR engine
HighlightingEnabledBooleanWhether the searched for term will have a span tag and class applied to it in the returned result summaries. For example <span class="icmhighlight">GOSS</span>
KeywordANDOperatorsStringA space separated list of characters you'd like to treat as AND operators. The defaults are AND and &&. If for some reason you wanted to treat the search term GOSS HELLOSAILOR Office as GOSS AND Office you could do that by setting "KeywordANDOperators": "HELLOSAILOR". Operators should be set in uppercase
KeywordNOTOperators StringA space separated list of characters to treat as NOT operators. See the AND operators above
KeywordOperatorIntegerThe operator that will be used between keywords:
1 - ACCRUE
2 - OR
3 - AND
4 - MANY
Default: OR
KeywordOROperatorsStringAs per the AND and NOT entries above
KeywordsStringA string of words to search for. Stemming will be applied and the OR operator is used
KeywordStemmingBooleanAlways enabled. Searching for film will return results for film, films, filming etc. Setting this property as false should disable stemming, but it doesn't seem to work
LastModifiedEndDateDateTimeOnly results modified before this date will be returned. Dates in an ISO 8601 combined format, ie "2018-02-01T00:00:00Z"
LastModifiedStartDateDateTimeOnly results modified after this date will be returned. Dates in an ISO 8601 combined format, ie "2018-02-01T00:00:00Z"
LuceneRepositoryPathStringThe path to SOLR
MaxFacetsIntegerThe maximum number of facets to return. Default: 10
MediaMetaDataIDsStringA string of comma separated metadata value IDs. Only media items that have all of these values related to them will be returned
MediaMetaDataOptionalIDsStringA string of comma separated metadata value IDs. Only media items that have any one of these values related to them will be returned
MediaTypeNamesStringA string of comma separated media type names. Only media items of these types will be returned
MinFacetCountIntegerThe minimum number of results a facet must have for it to appear. Default: 1 (so facets with single results will appear)
QueryFacetsObjectThe property in the returned itemData that holds the facet queries (if any)
RootArticleIDsStringA string of comma separated article IDs. Only the root items and their child items will be searched
RootForumIDsStringA string of comma separated forum IDs. Only the root items and their child items will be searched
RootMediaGroupIDsStringA string of comma separated media group IDs. Only the root items and their child items will be searched
RootProductGroupIDsStringA string of comma separated product group IDs. Only the root items and their child items will be searched
RootProductRackIDsStringA string of comma separated product rack IDs. Only the root items and their child items will be searched
RootThreadIDsStringA string of comma separated forum thread IDs. Only the root items and their child items will be searched
SearchCommandStringA string containing the search command. This overrides the keywords properties and, by default, ignores any root items or other restrictions set up. Generally only needed for more complex queries
SearchCommandActionIntegerSets whether the search command overrides search restrictions or not.
1 - Override the restrictions
2 - Only override the keywords property
Default: 1
SolrPageSizeIntegerThe number of CSSearchItems to display. Often used with SolrStartRow to implement paging
SolrParametersArrayAn array of SOLR parameter objects, each with Name and Value properties. See above
SolrResultCountIntegerThe number of results returned from SOLR
SolrStartPositionIntegerThe first CSSearchItem to display (zero based) from the results. Only needed when accessing results past the first 500, otherwise use StartRow
StartRowIntegerThe index of the first CSSearchItem displayed (1 based) from within those that would appear based on the SolrStartPosition. For example, paging has been implemented, the SolrPageSize displays 10 results per page, we're on page 2, so normally result 11 would appear first. Setting a StartRow of 2 would mean result 12 would appear first (and result 11 wouldn't appear on any page)
SubsiteIDIntegerThe ID of the subsite to search. This property will be ignored if RootArticleIDs or RootMediaIDs have been set
SummaryActionIntegerRemoves/manipulates markup in the Summary property of the CSSearchItem:
If the summary text is "test" goss <hahaha>
1 - No Action eg "Summary": "\"test\" goss <hahaha>"
2 - Remove Tags eg "Summary": "\"test\" goss "
3 - Escape Tags eg "Summary": "&quot;test&quot; goss &lt;hahaha&gt;"
TimeoutIntegerThe maximum time to wait during connection and getting results
UserIDIntegerA website UserID. Supply a UserID to return secure content in the search results. Performance can be improved by also supplying the list of the website user group IDs to which the specified user belongs.
Last modified on 28 October 2022

Share this page

Facebook icon Twitter icon email icon

Print

print icon