diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..e0e21a4 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..85e7012 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..03d9549 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..ca9b7d1 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..945452e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,15 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..078d1a6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/species-lists.iml b/.idea/species-lists.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/species-lists.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..82c663e --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lists-service/src/main/java/au/org/ala/listsapi/controller/GraphQLController.java b/lists-service/src/main/java/au/org/ala/listsapi/controller/GraphQLController.java index 8bef855..fc168b6 100644 --- a/lists-service/src/main/java/au/org/ala/listsapi/controller/GraphQLController.java +++ b/lists-service/src/main/java/au/org/ala/listsapi/controller/GraphQLController.java @@ -850,9 +850,11 @@ public List facetSpeciesLists( } Query aggQuery = builder.build(); + logger.info(aggQuery.toString()); SearchHits results = elasticsearchOperations.search(aggQuery, SpeciesListIndex.class); + logger.info(Objects.requireNonNull(results.getAggregations()).toString()); ElasticsearchAggregations agg = (ElasticsearchAggregations) results.getAggregations(); List facets = new ArrayList<>(); diff --git a/lists-service/src/main/resources/application.properties b/lists-service/src/main/resources/application.properties index 4eaf8aa..9be63d7 100644 --- a/lists-service/src/main/resources/application.properties +++ b/lists-service/src/main/resources/application.properties @@ -59,6 +59,6 @@ collectory.api.url=https://collections-test.ala.org.au # validation constraints constraints.file=/data/lists-service/config/constraints.json -#logging.level.tracer=TRACE -#logging.level.org.springframework=TRACE -#logging.level.com.baeldung=TRACE +logging.level.tracer=TRACE +logging.level.org.springframework=TRACE +logging.level.com.baeldung=TRACE diff --git a/lists-ui/.gitignore b/lists-ui/.gitignore index 5e8e904..8fa7063 100644 --- a/lists-ui/.gitignore +++ b/lists-ui/.gitignore @@ -198,4 +198,4 @@ yarn-error.log* /.env.production /.env.local /dist/* -/dist +/dist \ No newline at end of file diff --git a/lists-ui/src/api/graphql/performGQLQuery.ts b/lists-ui/src/api/graphql/performGQLQuery.ts index b4adea7..007d468 100644 --- a/lists-ui/src/api/graphql/performGQLQuery.ts +++ b/lists-ui/src/api/graphql/performGQLQuery.ts @@ -25,6 +25,7 @@ async function performGQLQuery( ); const data = await response.json(); + console.log('Response:', response, data); if (response.ok) { if (data.errors) { // If errorData is populated, we've recieved an error from the GraphQL server diff --git a/lists-ui/src/api/graphql/useGQLQuery.ts b/lists-ui/src/api/graphql/useGQLQuery.ts index 0112d79..00b2381 100644 --- a/lists-ui/src/api/graphql/useGQLQuery.ts +++ b/lists-ui/src/api/graphql/useGQLQuery.ts @@ -24,12 +24,14 @@ function useGQLQuery( useEffect(() => { async function runQuery() { if (data && options.clearDataOnUpdate) setData(null); + console.log('Running query:', query, variables); try { const queryData = await performGQLQuery( query, variables, options.token ); + console.log('Query result:', queryData); setData(queryData); setError(null); } catch (queryError) { diff --git a/lists-ui/src/views/Home/index.tsx b/lists-ui/src/views/Home/index.tsx index efa3bb2..fbeec8e 100644 --- a/lists-ui/src/views/Home/index.tsx +++ b/lists-ui/src/views/Home/index.tsx @@ -50,11 +50,17 @@ function Home() { size: size, filters: [], isPrivate: view === 'private', - ...(isUser ? { userid: ala.userid } : {}), + ...(ala.isAuthenticated ? { userid: ala.userid } : {}), }, { clearDataOnUpdate: false, token: ala.token } ); + useEffect(() => { + if (error) { + console.error('Elasticsearch Error:', error); + } + }, [error]); + // Destructure results & calculate the real page offset const { totalElements, totalPages, content } = data?.lists || {}; const realPage = page + 1; @@ -67,10 +73,10 @@ function Home() { size, filters, isPrivate: view === 'private', - ...(isUser ? { userid: ala.userid } : {}), + ...(ala.isAuthenticated ? { userid: ala.userid } : {}), }); // eslint-disable-next-line react-hooks/exhaustive-deps - }, [page, size, searchQuery, filters, refresh, view, isUser]); + }, [page, size, searchQuery, filters, refresh, view]); // Keep the current page in check useEffect(() => {