Sorting error when using fts-alfresco

cancel
Showing results for 
Search instead for 
Did you mean: 
chrisried
Member II

Sorting error when using fts-alfresco

There seems to be an issue with trying to sort on a base model field when I use a custom aspect in my query. This is the query I am trying to run:

 

var def = {
	query: 'TYPE:"cm:person" AND gf:userOrgs:RECEIVERORG',
	store: "workspace://SpacesStore",
	language: "fts-alfresco",
	page: {
		maxItems: 100,
		skipCount: 0
	},
	sort: [{
		column: 'cm:userName', 
		ascending: true
	}]
 };

var result = search.query(def);

The sort works fine when I "userName" as sort but as soons as I user "firstName" or "email" it fails. If I remove gf;userOrgs from the query it works fine. It gives the following error in the logs:

 

Caused by: org.alfresco.repo.search.impl.lucene.LuceneQueryParserException: 04270500 Request failed 500 /solr/alfresco/afts?wt=json&fl=DBID%2Cscore&rows=100&df=TEXT&start=0&locale=en_US&alternativeDic=DEFAULT_DICTIONARY&sort=cm%3AfirstName+asc&fq=%7B%21afts%7DAUTHORITY_FILTER_FROM_JSON&fq=%7B%21afts%7DTENANT_FILTER_FROM_JSON

 

My gf:userOrgs has been defined as an array on the user:

 

Collection
RECEIVERORG
CREATORORG

Any help would be appreciated, thanks.

 

10 Replies
chrisried
Member II

Re: Sorting error when using fts-alfresco

Also, I have tried indexing the custom aspect to see if that was the problem:

        <aspect name="gf:userOrganizations">
            <title>User Organizations</title>

            <properties>
                <property name="gf:userOrgs">
                    <title>Organizations</title>
                    <type>d:text</type>
                    <multiple>true</multiple>
                    <index enabled="true">
                        <atomic>true</atomic>
                        <stored>false</stored>
                        <tokenised>false</tokenised>
                        <facetable>true</facetable>
                    </index>
                </property>
            </properties>
        </aspect>

 

abhinavmishra14
Advanced

Re: Sorting error when using fts-alfresco

Try query as: 'TYPE:"cm\\:person" AND @gf\\:userOrgs:RECEIVERORG'

var def = {
	query: 'TYPE:"cm\\:person" AND @gf\\:userOrgs:RECEIVERORG',
	store: "workspace://SpacesStore",
	language: "fts-alfresco",
	page: {
		maxItems: 100,
		skipCount: 0
	},
	sort: [{
		column: 'cm:userName', 
		ascending: true
	}]
 };

var result = search.query(def);

 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
chrisried
Member II

Re: Sorting error when using fts-alfresco

Nope, I am still getting the same error.

abhinavmishra14
Advanced

Re: Sorting error when using fts-alfresco

Can you try running this query in node browser and see what you get:

'TYPE:"cm\\:person" AND @gf\\:userOrgs:RECEIVERORG'
~Abhinav
(ACSCE, AWS SAA, Azure Admin)
chrisried
Member II

Re: Sorting error when using fts-alfresco

 
chrisried
Member II

Re: Sorting error when using fts-alfresco

Running

'TYPE:"cm\\Smiley Tongueerson" AND @gf\\:userOrgs:RECEIVERORG' gives "No Items found" while running

TYPE:"cmSmiley Tongueerson" AND @gf:userOrgs:RECEIVERORG returns the appropriate results

chrisried
Member II

Re: Sorting error when using fts-alfresco

Sorry these are the correct queries:

 

'TYPE:"cm\\:person" AND @gf\\:userOrgs:RECEIVERORG'
TYPE:"cm:person" AND @gf:userOrgs:RECEIVERORG
abhinavmishra14
Advanced

Re: Sorting error when using fts-alfresco

The query i shared is the same query you posted here. When you execute it via js, you have to escape the characters. 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)
chrisried
Member II

Re: Sorting error when using fts-alfresco

SO there no results when running this query:

'TYPE:"cm:person" AND @gf:userOrgs:ORG1'

This is incorrect, I can see this aspect on the user:

Screen Shot 2020-06-10 at 12.57.29 PM.png