cancel
Showing results for 
Search instead for 
Did you mean: 

Solr, search API can't find any result without error

emirozmen
Champ on-the-rise
Champ on-the-rise

Hi, 

I'm trying to search through the files using search API but the problem is it doesn't return the all documents even if there is files in the alfresco.

I was using the query below, which is fine, and there are many files and folders under this path.

 

{
  "paging": {
    "maxItems": 100
  },
  "query": {
    "query": "PATH:\"/app:company_home/st:sites/cm:project/cm:documentLibrary//*\" AND TYPE:\"cm:content\""
  }
}

 

And this is a screen shot from the folder in the query

emirozmen_1-1733484184222.png

 

But it always returns the  results below (and not the results from screen shot above)

 

{
  "list": {
    "pagination": {
      "count": 10,
      "hasMoreItems": true,
      "totalItems": 11,
      "skipCount": 0,
      "maxItems": 10
    },
    "entries": [
      {
        "entry": {
          "createdAt": "2022-08-11T12:43:45.886",
          "isFolder": true,
          "search": {
            "score": 1
          },
          "isFile": false,
          "createdByUser": {
            "id": "admin",
            "displayName": "Administrator"
          },
          "modifiedAt": "2022-08-11T12:43:45.886",
          "modifiedByUser": {
            "id": "admin",
            "displayName": "Administrator"
          },
          "name": "components",
          "location": "nodes",
          "id": "2e0babb2-ba4f-4cca-b07c-af935f7b2407",
          "nodeType": "cm:folder",
          "parentId": "fa1e141a-5bd7-4793-9f3d-a02d1e2fc140"
        }
      },
      {
        "entry": {
          "createdAt": "2022-08-11T09:21:19.514",
          "isFolder": true,
          "search": {
            "score": 1
          },
          "isFile": false,
          "createdByUser": {
            "id": "System",
            "displayName": "System"
          },
          "modifiedAt": "2022-08-11T09:21:19.514",
          "modifiedByUser": {
            "id": "System",
            "displayName": "System"
          },
          "name": "invite",
          "location": "nodes",
          "id": "b8c7f9d0-f559-4890-8511-195e1463069f",
          "nodeType": "cm:folder",
          "parentId": "2153a0f4-7a4d-453a-a198-c75124d350eb"
        }
      },
      {
        "entry": {
          "createdAt": "2022-08-11T12:43:46.114",
          "isFolder": true,
          "search": {
            "score": 1
          },
          "isFile": false,
          "createdByUser": {
            "id": "admin",
            "displayName": "Administrator"
          },
          "modifiedAt": "2022-08-11T12:43:46.114",
          "modifiedByUser": {
            "id": "admin",
            "displayName": "Administrator"
          },
          "name": "admin",
          "location": "nodes",
          "id": "105388b3-7ba4-4f3f-83a0-bf647d5dc1d9",
          "nodeType": "cm:folder",
          "parentId": "1d4132f6-36f6-449a-afc0-64da4e12effa"
        }
      },
      {
        "entry": {
          "createdAt": "2022-08-11T09:21:19.582",
          "isFolder": true,
          "search": {
            "score": 1
          },
          "isFile": false,
          "createdByUser": {
            "id": "System",
            "displayName": "System"
          },
          "modifiedAt": "2022-08-11T09:21:19.582",
          "modifiedByUser": {
            "id": "System",
            "displayName": "System"
          },
          "name": "Saved Searches",
          "location": "nodes",
          "id": "85e3fdd2-d403-4eba-8bdf-5a682d4f2b08",
          "nodeType": "cm:folder",
          "parentId": "6cd25e62-5638-453e-b846-243285ec8045"
        }
      },
      {
        "entry": {
          "createdAt": "2022-08-11T12:43:46.094",
          "isFolder": true,
          "search": {
            "score": 1
          },
          "isFile": false,
          "createdByUser": {
            "id": "admin",
            "displayName": "Administrator"
          },
          "modifiedAt": "2022-08-11T12:43:46.094",
          "modifiedByUser": {
            "id": "admin",
            "displayName": "Administrator"
          },
          "name": "pages",
          "location": "nodes",
          "id": "bf305747-361a-4e05-8d45-4f5846a2852f",
          "nodeType": "cm:folder",
          "parentId": "fa1e141a-5bd7-4793-9f3d-a02d1e2fc140"
        }
      },
      {
        "entry": {
          "createdAt": "2022-08-11T09:21:19.656",
          "isFolder": true,
          "search": {
            "score": 1
          },
          "isFile": false,
          "createdByUser": {
            "id": "System",
            "displayName": "System"
          },
          "modifiedAt": "2022-08-11T09:21:19.656",
          "modifiedByUser": {
            "id": "System",
            "displayName": "System"
          },
          "name": "Node Templates",
          "location": "nodes",
          "id": "8fab2303-b06a-4f73-b867-f63633030d75",
          "nodeType": "cm:folder",
          "parentId": "6cd25e62-5638-453e-b846-243285ec8045"
        }
      },
      {
        "entry": {
          "createdAt": "2022-08-11T12:43:46.104",
          "isFolder": true,
          "search": {
            "score": 1
          },
          "isFile": false,
          "createdByUser": {
            "id": "admin",
            "displayName": "Administrator"
          },
          "modifiedAt": "2022-08-11T12:43:46.104",
          "modifiedByUser": {
            "id": "admin",
            "displayName": "Administrator"
          },
          "name": "user",
          "location": "nodes",
          "id": "1d4132f6-36f6-449a-afc0-64da4e12effa",
          "nodeType": "cm:folder",
          "parentId": "bf305747-361a-4e05-8d45-4f5846a2852f"
        }
      },
      {
        "entry": {
          "createdAt": "2022-08-11T09:21:19.716",
          "isFolder": true,
          "search": {
            "score": 1
          },
          "isFile": false,
          "createdByUser": {
            "id": "System",
            "displayName": "System"
          },
          "modifiedAt": "2022-08-11T09:21:19.716",
          "modifiedByUser": {
            "id": "System",
            "displayName": "System"
          },
          "name": "Smart Folder Downloads",
          "location": "nodes",
          "id": "46a6d1de-3d58-4de8-bf18-27d5d166ae8f",
          "nodeType": "cm:folder",
          "parentId": "6cd25e62-5638-453e-b846-243285ec8045"
        }
      },
      {
        "entry": {
          "isFile": true,
          "createdByUser": {
            "id": "admin",
            "displayName": "Administrator"
          },
          "modifiedAt": "2022-08-11T12:43:46.239",
          "nodeType": "cm:content",
          "content": {
            "mimeType": "text/xml",
            "mimeTypeName": "XML",
            "sizeInBytes": 284,
            "encoding": "UTF-8"
          },
          "parentId": "2e0babb2-ba4f-4cca-b07c-af935f7b2407",
          "createdAt": "2022-08-11T12:43:45.919",
          "isFolder": false,
          "search": {
            "score": 1
          },
          "modifiedByUser": {
            "id": "admin",
            "displayName": "Administrator"
          },
          "name": "page.title.user~admin~dashboard.xml",
          "location": "nodes",
          "id": "8319f9db-1a7c-4801-9b42-182cc13e5158"
        }
      },
      {
        "entry": {
          "createdAt": "2022-08-11T09:21:19.754",
          "isFolder": true,
          "search": {
            "score": 1
          },
          "isFile": false,
          "createdByUser": {
            "id": "System",
            "displayName": "System"
          },
          "modifiedAt": "2022-08-11T09:21:19.754",
          "modifiedByUser": {
            "id": "System",
            "displayName": "System"
          },
          "name": "Guest Home",
          "location": "nodes",
          "id": "da442c55-0163-47ca-a46c-08bcd5b50871",
          "nodeType": "cm:folder",
          "parentId": "46115fe3-47a8-4bbc-a277-c046a7cf46c7"
        }
      }
    ]
  }
}

 



Therefore I checked the logs, but I can not see any errors, only some warnings but I don't think they are related.

This is the Alfresco logs

 

06-Dec-2024 11:16:41.493 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in [49851] milliseconds
2024-12-06 11:16:41,702  INFO  [management.subsystems.ChildApplicationContextFactory] [http-nio-8080-exec-1] Starting 'Search' subsystem, ID: [Search, managed, solr6]
2024-12-06 11:16:42,037  INFO  [management.subsystems.ChildApplicationContextFactory] [http-nio-8080-exec-1] Startup of 'Search' subsystem, ID: [Search, managed, solr6] complete
2024-12-06 11:17:10,605  INFO  [management.subsystems.ChildApplicationContextFactory] [http-nio-8080-exec-1] Starting 'Transformers' subsystem, ID: [Transformers, default]
2024-12-06 11:17:10,651  INFO  [management.subsystems.ChildApplicationContextFactory] [http-nio-8080-exec-1] Startup of 'Transformers' subsystem, ID: [Transformers, default] complete

 

 And this is the solr6 logs

 

Picked up JAVA_TOOL_OPTIONS:  -Dalfresco.secureComms.secret=secret 
Picked up JAVA_TOOL_OPTIONS:  -Dalfresco.secureComms.secret=secret 
Picked up JAVA_TOOL_OPTIONS:  -Dalfresco.secureComms.secret=secret 
Picked up JAVA_TOOL_OPTIONS:  -Dalfresco.secureComms.secret=secret 
Picked up JAVA_TOOL_OPTIONS:  -Dalfresco.secureComms.secret=secret 
OpenJDK 64-Bit Server VM warning: Option UseConcMarkSweepGC was deprecated in version 9.0 and will likely be removed in a future release.
2024-12-06 11:15:55.439 INFO  (main) [   ] o.e.j.s.Server jetty-9.3.30.v20211001, build timestamp: 2021-10-01T15:51:54Z, git hash: 148ea770504ad315b7936c5737e462879680042b
2024-12-06 11:15:56.597 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter  ___      _       Welcome to Apache Solr™ version 6.6.5-patched.9 10ac21abfb0df29f82d945ebe6df8e2684a3f837 - jamal - 2022-03-11 03:14:48
2024-12-06 11:15:56.597 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter / __| ___| |_ _   Starting in standalone mode on port 8983
2024-12-06 11:15:56.597 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter \__ \/ _ \ | '_|  Install dir: /opt/alfresco-search-services/solr
2024-12-06 11:15:56.612 INFO  (main) [   ] o.a.s.s.SolrDispatchFilter |___/\___/_|_|    Start time: 2024-12-06T11:15:56.605062Z
2024-12-06 11:15:58.066 INFO  (main) [   ] o.e.j.s.Server Started @4437ms
2024-12-06 11:16:07.906 WARN  (Thread-12) [   x:alfresco] o.a.s.c.Config XML parse warning in "solrres:/solrconfig.xml", line 1959, column 88: Include operation failed, reverting to fallback. Resource error reading file as XML (href='solrconfig_insight.xml'). Reason: Can't find resource 'solrconfig_insight.xml' in classpath or '/opt/alfresco-search-services/solrhome/alfresco'
2024-12-06 11:16:07.974 WARN  (Thread-12) [   x:alfresco] o.a.s.c.Config You should not use LATEST as luceneMatchVersion property: if you use this setting, and then Solr upgrades to a newer release of Lucene, sizable changes may happen. If precise back compatibility is important then you should instead explicitly specify an actual Lucene version.
2024-12-06 11:16:08.068 WARN  (Thread-12) [   x:alfresco] o.a.s.c.Config Beginning with Solr 5.5, <mergePolicy> is deprecated, use <mergePolicyFactory> instead.
2024-12-06 11:16:08.909 WARN  (Thread-12) [   x:alfresco] o.a.s.c.SolrResourceLoader Solr loaded a deprecated plugin/analysis class [org.apache.solr.analysis.WordDelimiterFilterFactory]. Please consult documentation how to replace it accordingly.
2024-12-06 11:16:08.915 WARN  (Thread-12) [   x:alfresco] o.a.s.c.SolrResourceLoader Solr loaded a deprecated plugin/analysis class [solr.SynonymFilterFactory]. Please consult documentation how to replace it accordingly.
2024-12-06 11:16:09.257 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field content@s____@* is not multivalued and destination for multiple copyFields (8)
2024-12-06 11:16:09.258 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field content@s__lt@* is not multivalued and destination for multiple copyFields (8)
2024-12-06 11:16:09.258 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field text@s__sort@* is not multivalued and destination for multiple copyFields (8)
2024-12-06 11:16:09.258 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field text@s____@* is not multivalued and destination for multiple copyFields (16)
2024-12-06 11:16:09.259 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field content@s__l_@* is not multivalued and destination for multiple copyFields (8)
2024-12-06 11:16:09.259 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field text@s__l_@* is not multivalued and destination for multiple copyFields (16)
2024-12-06 11:16:09.259 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field text@s__lt@* is not multivalued and destination for multiple copyFields (16)
2024-12-06 11:16:09.259 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field text@s___t@* is not multivalued and destination for multiple copyFields (8)
2024-12-06 11:16:09.259 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field content@s___t@* is not multivalued and destination for multiple copyFields (4)
2024-12-06 11:16:10.703 WARN  (Thread-12) [   x:alfresco] o.a.s.h.c.ClusteringComponent No default engine for document clustering.
2024-12-06 11:16:10.901 WARN  (Thread-12) [   x:alfresco] o.a.s.c.Config XML parse warning in "solrres:/solrconfig.xml", line 1959, column 88: Include operation failed, reverting to fallback. Resource error reading file as XML (href='solrconfig_insight.xml'). Reason: Can't find resource 'solrconfig_insight.xml' in classpath or '/opt/alfresco-search-services/solrhome/archive'
2024-12-06 11:16:10.935 WARN  (Thread-12) [   x:alfresco] o.a.s.c.Config Beginning with Solr 5.5, <mergePolicy> is deprecated, use <mergePolicyFactory> instead.
2024-12-06 11:16:11.137 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field content@s____@* is not multivalued and destination for multiple copyFields (8)
2024-12-06 11:16:11.137 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field content@s__lt@* is not multivalued and destination for multiple copyFields (8)
2024-12-06 11:16:11.137 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field text@s__sort@* is not multivalued and destination for multiple copyFields (8)
2024-12-06 11:16:11.137 WARN  (Thread-12) [   x:alfresco] o.a.s.s.IndexSchema Field text@s____@* is not multivalued and destination for multiple copyFields (16)

 

 

 

 

1 ACCEPTED ANSWER

emirozmen
Champ on-the-rise
Champ on-the-rise

I found my problem, my query was wrong. I needed to add the path to make it work. Without path, it searchs in some other default path I think.


 

{
"paging": {
"maxItems": "100"
},
"query": {
"query": "PATH: \"app:company_home/st:sites/cm:project/cm:documentLibrary//*\" and TYPE:\"content\""
   },
 "include": ["properties"],
"fields": ["id", "name", "createdAt", "modifiedAt","path"]
}

 

View answer in original post

6 REPLIES 6

jaypatel
Champ in-the-making
Champ in-the-making

You are using direct uid password to login with api ? if there is some auth mechanism , please help me for the community version

 

You need to login and obtain the encoded token, then decode and use it.

 

curl --request POST \
  --url http://localhost:7735/alfresco/api/-default-/public/authentication/versions/1/tickets \
  --header 'content-type: application/json' \
  --data '{
  "userId":"username",
  "password":"password"
}'

 

jaypatel
Champ in-the-making
Champ in-the-making

Yes but ticket will expire in some time right , but i need not to store any credentials in my db , just to authorize and store some tokens .  Any idea about this ?

in that case define the credentials as a secret env variable, and retrieve it from the secret whenever it expires

jaypatel
Champ in-the-making
Champ in-the-making

Ok thanks 👍

emirozmen
Champ on-the-rise
Champ on-the-rise

I found my problem, my query was wrong. I needed to add the path to make it work. Without path, it searchs in some other default path I think.


 

{
"paging": {
"maxItems": "100"
},
"query": {
"query": "PATH: \"app:company_home/st:sites/cm:project/cm:documentLibrary//*\" and TYPE:\"content\""
   },
 "include": ["properties"],
"fields": ["id", "name", "createdAt", "modifiedAt","path"]
}