In Axiell Collections databases a lot of fields are repeatable, which means that they can have more than one field occurrence. For example, a book can have multiple authors and a museum object can have multiple object names: each author or object name will be stored in its own field occurrence. Indexes on repeatable fields usually index all the occurrences of a field, so that a record can be found on any of the values in the field. If you do not apply sorting to the wwwopac.ashx search result, a record will appear only once in the search result even if you searched on a repeatable field. However, if you do apply sorting to a wwwopac.ashx search result, a record will appear in the search result as many times as the sorting field has occurrences. So if you search a museum object by its creator and you sort on object name, then by default a single retrieved record with three object names will appear three times in the sorted search result.
If you want to apply sorting on a certain repeated field while making sure a record appears only once in the search result, you will have to create an extra index which firstly indexes a dummy tag and secondly the first occurrence of the field you want to be able to sort on. This means that sorting will then always be done on the first occurrence of the field while you can still search on values from all field occurrences. However, this only possible for non-linked fields: currently there is no solution to sort on the first occurrence of a repeated, linked (on reference) field without records possibly appearing more than once in the search result. Unfortunately this limits the number of fields to sort on (using the first occurrence only) substantially and probably leaves your functionality requirement without solution.
If you do have a repeatable, non-linked field you want to sort on while having records appear in the search result only once, then this is fairly easy to set this up using Axiell Designer. Let's take the production.date.start field (tag DS) in the Collect database as our example. DS is a repeatable, non-linked field. In our model application 4.2 there already exists the startdat index on this tag which indexes all occurrences. This index is perfect for searching and you want to keep it that way. Proceed as follows to create an extra index for sorting:
aa
for example. prodstartdate_for_sorting
. This is just a dummy field, so you can leave all other options to their default values. Save the changes in the database structure.aa
) at the top of the list; in the second place on the list, enter the originally indexed tag (e.g. DS
). Then mark the First occurrence only checkbox. Set the other options as in the original index. Save the changes in the database structure.