cancel
Showing results for 
Search instead for 
Did you mean: 

MDM Product Search : How to sort the results ?

Former Member
0 Kudos

Which APIs (options) are available to sort the product search results into more relevant sequence.

We want that the results should not be ordered by SKU # but by the relevant search string.

Eg. when searching for SKU # 65-100 the current results show 65-100 much later and other SKUs containing the string 65-100 (eg. 300-65-100, are shown first).

Thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Here is one suggestion for achieving what you want:

Do 2 searches - the first for SKU's starting with "65-100" (using the FreeFormParameter.PrefixSearchType), and the second search using the FreeFormParameter.SubstringSearchType parameter.

Now display the results of the searches, one after the other, ensuring not to display the same result twice.

Walter

Former Member
0 Kudos

Hello Vipul:

You can use the signature for retrieve the result set, as explained in the API reference:

GetResultSet Method

Returns an A2iResultSet based on limiting search parameters.

Syntax

CatalogData.GetResultSet(Search : Search,

ResultSetDefinition : ResultSetDefiniton, SortField :

String, SortAscending : boolean, Page : long) :

A2iResultSet

Argument Description

Search Search object containing the search parameters

ResultSetDefinition Name of ResultSetDefinition object (see

ResultSetDefinition class on page 182)

<b>SortField </b> Field to sort on or null

SortAscending true sorts limited records in ascending order

Page Indicates page (beginning with 0) to retrieve if a page

size is set in ResultSetDefinition object

Return Value A2iResultSet object

And the following example:


import a2i.generated.*;
import a2i.common.*;
import a2i.search.*;
Search search = new Search("Products");
ResultSetDefinition rsd = new
ResultSetDefinition("Products");
rsd.AddField("Part Number");
A2iResultSet rs = catalogData.GetResultSet(search, rsd,
"Part Number", true, 0);
System.out.println(rs.GetRecordCount());

I hope this helps

Greetings

Alejandro