cancel
Showing results for 
Search instead for 
Did you mean: 

SOLR search with PATH get wrong results

MartinTichovsky
Champ in-the-making
Champ in-the-making

Hello,

i have problem with Alfresco search. I have this query

{
"include": ["path"],
"paging":{"maxItems":10,"skipCount":0},
"query":{
"language":"afts",
"query":"PATH:'/app:company_home/st:sites/cm:test/cm:documentLibrary/cm:Folder//*' AND TYPE:'cm:content'"
}
}

In site Test/documentLibrary/Folder i have one file, second file is stored in Site Mirror and both are acssociated through this API request

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic YWRtaW46YWRtaW4=' -d '{
  "childId": "ad78ddfe-e827-4b2c-957d-e1a18613486f",
  "assocType": "cm:preferenceImage"
}' 'http://xxx:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/f59a569d-cb26-48f3-acc0-f592cd95f8db/secondary-children'

 And i will get two results (but must be only one) here is response (i deleted useless properties)

{
    "entries": [
      {
        "entry": {
          "isFile": true,
          "nodeType": "cm:content",
"parentId": "8a4e471e-e043-4a93-8f08-0f2f66994030", "path": { "name": "/Company Home/Sites/mirror/documentLibrary", "isComplete": true, "elements": [ { "id": "cbd46e1c-55e8-47ee-b87c-dd8c9aca7a76", "name": "Company Home", "nodeType": "cm:folder", "aspectNames": [ "ssl:ssid_counter", "cm:titled", "cm:auditable", "ssl:pid_counter", "ssl:pid_concept_counter", "app:uifacets" ] }, { "id": "5fe1c19f-4827-4165-b2f5-5442d1c9b679", "name": "Sites", "nodeType": "st:sites", "aspectNames": [ "cm:titled", "cm:auditable", "app:uifacets" ] }, { "id": "c35a80df-6eba-422f-ba99-e534b182a6af", "name": "mirror", "nodeType": "st:site", "aspectNames": [ "cm:tagscope", "cm:titled", "cm:auditable" ] }, { "id": "8a4e471e-e043-4a93-8f08-0f2f66994030", "name": "documentLibrary", "nodeType": "cm:folder", "aspectNames": [ "cm:tagscope", "st:siteContainer", "cm:ownable", "cm:titled", "cm:auditable" ] } ] }, "id": "ad78ddfe-e827-4b2c-957d-e1a18613486f" } }, { "entry": { "isFile": true, "nodeType": "cm:content", "parentId": "6b0282aa-373f-4609-bc4e-a65b2c809ddf", "path": { "name": "/Company Home/Sites/test/documentLibrary/Folder", "isComplete": true, "elements": [ { "id": "cbd46e1c-55e8-47ee-b87c-dd8c9aca7a76", "name": "Company Home", "nodeType": "cm:folder", "aspectNames": [ "ssl:ssid_counter", "cm:titled", "cm:auditable", "ssl:pid_counter", "ssl:pid_concept_counter", "app:uifacets" ] }, { "id": "5fe1c19f-4827-4165-b2f5-5442d1c9b679", "name": "Sites", "nodeType": "st:sites", "aspectNames": [ "cm:titled", "cm:auditable", "app:uifacets" ] }, { "id": "6cc36fff-5da8-4f2d-90b1-3f81010347a6", "name": "test", "nodeType": "st:site", "aspectNames": [ "cm:tagscope", "cm:titled", "cm:auditable" ] }, { "id": "9a9dd211-2e5a-4c29-a3d8-7eb1fece9230", "name": "documentLibrary", "nodeType": "cm:folder", "aspectNames": [ "cm:tagscope", "st:siteContainer", "cm:ownable", "cm:titled", "cm:auditable" ] }, { "id": "6b0282aa-373f-4609-bc4e-a65b2c809ddf", "name": "Folder", "nodeType": "cm:folder", "aspectNames": [ "cm:titled", "cm:auditable" ] } ] }, "id": "f59a569d-cb26-48f3-acc0-f592cd95f8db" } } ] } }

Any idea how can i fix this problem to tell search ignore associated files? Thanks

1 ACCEPTED ANSWER

afaust
Legendary Innovator
Legendary Innovator

There is no way to ignore that associated file after you have created the secondary child relationship, unless you were to include an additional "NOT PATH" condition into your query to target the document you don't want in the result.

The search result is actually perfectly correct. Because you have created the secondary child relationship, you have technically created a second path via which the associated node is reachable. Since the PATH condition does not differentiate between primary or secondary paths, it matches that associated document now just as well as it does the document which has its primary path in the specified path structure.

View answer in original post

1 REPLY 1

afaust
Legendary Innovator
Legendary Innovator

There is no way to ignore that associated file after you have created the secondary child relationship, unless you were to include an additional "NOT PATH" condition into your query to target the document you don't want in the result.

The search result is actually perfectly correct. Because you have created the secondary child relationship, you have technically created a second path via which the associated node is reachable. Since the PATH condition does not differentiate between primary or secondary paths, it matches that associated document now just as well as it does the document which has its primary path in the specified path structure.