-
Notifications
You must be signed in to change notification settings - Fork 3
Description
I noticed some issues in model:build-search-options when I set facetable="true" for a domain:attribute field, and received an error message about a missing element range index:
- The WIKI states on that @searchable "Determines if the field will create a search constraint associated with an element using search:search constraint." However the first line of model:build-search-options uses @searchable to determine whether the field goes into $properties, and thus whether it can participate in any aspect of search:search such as Sorting, Faceting, Metadata return, etc. Because all these are based on $properties, one has to create a searchable constraint just to use a field in some other context. I don't believe that was meant to be, because there is a second now-redundant test for @searchable in the code which builds $constraint. Perhaps the broader $properties test should be for fields with a domain:navigation element present.
- The code which builds the constraint has this:
<search:element name="{$prop/@name}" ns="{$ns}" >{
(
if ($prop instance of attribute()) then
<search:attribute name="{$prop/@name}" ns="{$ns}"/>
else ()
)
}</search:element>,
Since $prop is a $DOMAIN-NODE-FIELD, shouldn't the test be of element(domain:attribute), and in that case, shouldn't the search:element's name be the name of the domain:element or domain:container enclosing the attribute rather than the same as the search:attribute's name?
- The same pattern regarding attribute specification occurs when building $suggestOptions.
- No attempt at handling attributes is currently made for $sortOptions. Presumably if the pattern for correctly generating a search:element search:attribute is embodied in a function, it can be invoked here as well.
- A different format is used to specify elements and attributes for $metadataOptions. But it should be simple enough to construct a search:qname from a search:element/search:attribute set generated by the aforementioned function. Additionally, per Model to allow creation of indexes for particular elements / attributes #1 above, one wants to be able to specify metadata fields which would never be a part of the search itself.
If my analysis of the above is correct, I would be happy to produce a solution. The tricky part could be finding the containing element for a model-level domain:attribute for domain:models which are used as types for one or more domain:elements. Is that logic encapsulated (or at least demonstrated) anywhere in the existing code?
- J.J.