xenit-eu/alfred-api

Search: Property values that can never match should be filtered out

Closed this issue · 1 comments

It is currently possible to search for a property, with a value that is impossible to exist, due to type definitions in Alfresco. An easy example which can be used to reproduce this, is the sys:node-dbid property, which is a property of type d:long. Searching for that property with a value of Long.MAX_VALUE + 1 will return an error. Searching with Long.MAX_VALUE succeeds and just returns an empty set (as no one has that many nodes).

curl -v -u admin:admin localhost:32787/alfresco/s/apix/v1/search -XPOST -H 'Content-Type: application/json' -d '{"query":{"and":[{"or":[{"property":{"name":"sys:node-dbid","value":"9223372036854775808"}}]}]}}'

Systems that query Alfresco (through Alfred Api for example) should not need to know about the datatype of properties that are in the custom models of the Alfresco. In our case, a system (Alfred Finder) expands a value to all sets of property name : that value
As a necessary workaround, Alfred Api can check the datatype using the Alfresco DictionaryService and filter out the terms that do not comply with the datatype of their property value, before sending out the query to Alfresco.

After more research, we opened a support ticket at Alfresco. This is an issue that only starts occurring after using Solr 6.
Related issues:
https://myalfresco.force.com/support/CaseView?id=5003z000028YOD5
Alfresco/SearchServices#334
https://issues.alfresco.com/jira/browse/MNT-19252

We will need a workaround in Alfred Api, as we don't expect the fix in Alfresco to be backported.