Skip to content

Commit

Permalink
alterando a busca para os novos índices:release2
Browse files Browse the repository at this point in the history
  • Loading branch information
jesielviana committed Nov 13, 2023
1 parent 30d5a32 commit 19baabf
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 36 deletions.
8 changes: 8 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ const nextConfig = {
LANGUAGES: process.env.LANGUAGES,
ELASTIC_INDEXES: process.env.ELASTIC_INDEXES,
PUBLIC_RECAPTCHA_SITE_KEY: process.env.PUBLIC_RECAPTCHA_SITE_KEY,
INDEX_PUBLICATION: process.env.INDEX_PUBLICATION,
INDEX_PERSON: process.env.INDEX_PERSON,
INDEX_ORGUNIT: process.env.INDEX_ORGUNIT,
INDEX_JOURNAL: process.env.INDEX_JOURNAL,
INDEX_PROGRAM: process.env.INDEX_PROGRAM,
INDEX_PATENT: process.env.INDEX_PATENT,
INDEX_GROUP: process.env.INDEX_GROUP,
INDEX_SOFTWARE: process.env.INDEX_SOFTWARE,
},
i18n,
webpack5: true,
Expand Down
2 changes: 1 addition & 1 deletion src/components/AdvancedSearchBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const AdvancedSearchBox = ({
<textarea
value={query}
placeholder={`${t('Enter at least 3 characters and search among')} ${t('numberFormat', {
value: docsCount,
value: docsCount || 0,
})} ${t('documents')}`}
onChange={(e) => setQuery(e.target.value)}
rows={1}
Expand Down
16 changes: 8 additions & 8 deletions src/components/AllIndexVisNetwork.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface IndexNode extends Node {
const nodes: IndexNode[] = [
{
id: 1,
index: 'pesqdf-publication',
index: process.env.INDEX_PUBLICATION || '',
label: 'Publications',
title: '100',
widthConstraint: 100,
Expand All @@ -40,7 +40,7 @@ const nodes: IndexNode[] = [
},
{
id: 2,
index: 'pesqdf-person',
index: process.env.INDEX_PERSON || '',
label: 'People',
size: 200,
title: '100',
Expand All @@ -54,7 +54,7 @@ const nodes: IndexNode[] = [
},
{
id: 3,
index: 'pesqdf-journals',
index: process.env.INDEX_JOURNAL || '',
label: 'Journals',
title: '100',
level: 3,
Expand All @@ -67,7 +67,7 @@ const nodes: IndexNode[] = [
},
{
id: 4,
index: 'pesqdf-orgunit',
index: process.env.INDEX_ORGUNIT || '',
label: 'Institutions',
title: '100',
level: 4,
Expand All @@ -80,7 +80,7 @@ const nodes: IndexNode[] = [
},
{
id: 5,
index: 'pesqdf-patent',
index: process.env.INDEX_PATENT || '',
label: 'Patentes',
title: '100',
level: 5,
Expand All @@ -93,7 +93,7 @@ const nodes: IndexNode[] = [
},
{
id: 6,
index: 'pesqdf-program',
index: process.env.INDEX_PROGRAM || '',
label: 'PPGs',
title: '100',
level: 6,
Expand All @@ -106,7 +106,7 @@ const nodes: IndexNode[] = [
},
{
id: 7,
index: 'researchgroups',
index: process.env.INDEX_GROUP || '',
label: 'Research Groups',
title: '100',
level: 7,
Expand All @@ -118,7 +118,7 @@ const nodes: IndexNode[] = [
},
{
id: 8,
index: 'pesqdf-software',
index: process.env.INDEX_SOFTWARE || '',
label: 'Software',
title: '100 ',
level: 8,
Expand Down
3 changes: 2 additions & 1 deletion src/components/BasicSearchBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const BasicSearchBox = ({
const { t } = useTranslation('common');
const router = useRouter();
const [docsCount, setDocsCount] = useState(localStorage.getItem(indexName));
console.log('indexName', indexName);

useEffect(() => {
ElasticSearchStatsService(indexName)
Expand Down Expand Up @@ -74,7 +75,7 @@ const BasicSearchBox = ({
type="text"
value={value}
placeholder={`${t('Enter at least 3 characters and search among')} ${t('numberFormat', {
value: docsCount,
value: docsCount || 0,
})} ${t('documents')}`}
onChange={(e) => onChange(e.target.value)}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/indicators/GroupsIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { OptionsBar, OptionsPie } from './options/ChartsOptions';
import getFormatedQuery from './query/Query';

ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement);
const INDEX_NAME = 'researchgroups';
const INDEX_NAME = process.env.INDEX_GROUP || '';

const optResearchLine = new OptionsPie('Research groups by Research line');
const optKnowledgeArea = new OptionsPie('Research groups by knowledge area');
Expand Down
2 changes: 1 addition & 1 deletion src/components/indicators/JornalsIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { OptionsBar } from './options/ChartsOptions';
import getFormatedQuery from './query/Query';

ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement);
const INDEX_NAME = 'pesqdf-journals';
const INDEX_NAME = process.env.INDEX_JOURNAL || '';

const optQualis = new OptionsBar('Journals by qualis');

Expand Down
2 changes: 1 addition & 1 deletion src/components/indicators/OrgUnitIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { OptionsBar } from './options/ChartsOptions';
import getFormatedQuery from './query/Query';

ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement);
const INDEX_NAME = 'pesqdf-orgunit';
const INDEX_NAME = process.env.INDEX_ORGUNIT || '';

const options = new OptionsBar('Institutions by country');
const optionsState = new OptionsBar('Institutions by state');
Expand Down
2 changes: 1 addition & 1 deletion src/components/indicators/PatentsIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { OptionsBar, OptionsPie } from './options/ChartsOptions';
import getFormatedQuery from './query/Query';

ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement);
const INDEX_NAME = 'pesqdf-patent';
const INDEX_NAME = process.env.INDEX_PATENT || '';

const optDepositDate = new OptionsBar('Patents by deposit year');
const optPubDate = new OptionsBar('Patents by publication year');
Expand Down
2 changes: 1 addition & 1 deletion src/components/indicators/PeopleIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { OptionsPie } from './options/ChartsOptions';
import getFormatedQuery from './query/Query';

ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement);
const INDEX_NAME = 'pesqdf-person';
const INDEX_NAME = process.env.INDEX_PERSON || '';

export const optionsResearchArea = new OptionsPie('Research areas');

Expand Down
2 changes: 1 addition & 1 deletion src/components/indicators/ProgramsIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { OptionsBar } from './options/ChartsOptions';
import getFormatedQuery from './query/Query';

ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement);
const INDEX_NAME = 'pesqdf-program';
const INDEX_NAME = process.env.INDEX_PROGRAM || '';

export const options = new OptionsBar('Program by OrgUnit', false);

Expand Down
2 changes: 1 addition & 1 deletion src/components/indicators/PublicationsIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { OptionsBar, OptionsPie } from './options/ChartsOptions';
import getFormatedQuery from './query/Query';

ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement);
const INDEX_NAME = 'pesqdf-publication';
const INDEX_NAME = process.env.INDEX_PUBLICATION || '';
export const options = new OptionsBar('Documents by year');
export const optionsType = new OptionsPie('Documents by type');

Expand Down
2 changes: 1 addition & 1 deletion src/components/indicators/SoftwaresIndicators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { OptionsBar, OptionsPie } from './options/ChartsOptions';
import getFormatedQuery from './query/Query';

ChartJS.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend, ArcElement);
const INDEX_NAME = 'pesqdf-software';
const INDEX_NAME = process.env.INDEX_SOFTWARE || '';

const optPubDate = new OptionsBar('Softwares by release year');
const optknowledgeAreas = new OptionsPie('Softwares by knowledge area');
Expand Down
2 changes: 1 addition & 1 deletion src/pages/groups.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const getStaticProps: GetStaticProps<Props> = async ({ locale }) => ({
},
});

const INDEX_NAME = 'researchgroups';
const INDEX_NAME = process.env.INDEX_GROUP || '';
const configDefault = {
...DefaultQueryConfig(INDEX_NAME),
searchQuery: {
Expand Down
18 changes: 9 additions & 9 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ export default function App() {
const { t } = useTranslation('common');

const indexes = [
{ text: 'Publications', page: 'publications', name: 'pesqdf-publication' },
{ text: 'People', page: 'people', name: 'pesqdf-person' },
{ text: 'Journals', page: 'journals', name: 'pesqdf-journals' },
{ text: 'Institutions', page: 'institutions', name: 'pesqdf-orgunit' },
{ text: 'Patents', page: 'patents', name: 'pesqdf-patent' },
{ text: 'Programs', page: 'programs', name: 'pesqdf-program' },
{ text: 'Research Groups', page: 'groups', name: 'researchgroups' },
{ text: 'Software', page: 'software', name: 'pesqdf-software' },
{ text: 'Publications', page: 'publications', name: process.env.INDEX_PUBLICATION || '' },
{ text: 'People', page: 'people', name: process.env.INDEX_PERSON || '' },
{ text: 'Journals', page: 'journals', name: process.env.INDEX_JOURNAL || '' },
{ text: 'Institutions', page: 'institutions', name: process.env.INDEX_ORGUNIT || '' },
{ text: 'Patents', page: 'patents', name: process.env.INDEX_PATENT || '' },
{ text: 'Programs', page: 'programs', name: process.env.INDEX_PROGRAM || '' },
{ text: 'Research Groups', page: 'groups', name: process.env.INDEX_GROUP || '' },
{ text: 'Software', page: 'software', name: process.env.INDEX_SOFTWARE || '' },
];
const partners = [
{
Expand Down Expand Up @@ -74,7 +74,7 @@ export default function App() {
];
const [term, setTerm] = useState('');
const [searchPage, setSearchPage] = useState('publications');
const [selectedIndex, setSelectedIndex] = useState('pesqdf-publication');
const [selectedIndex, setSelectedIndex] = useState(process.env.INDEX_PUBLICATION || '');
const [docsCount, setDocsCount] = useState('');

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/institutions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const getStaticProps: GetStaticProps<Props> = async ({ locale }) => ({
},
});

const INDEX_NAME = 'pesqdf-orgunit';
const INDEX_NAME = process.env.INDEX_ORGUNIT || '';
const configDefault = {
...DefaultQueryConfig(INDEX_NAME),
searchQuery: {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/journals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const getStaticProps: GetStaticProps<Props> = async ({ locale }) => ({
},
});

const INDEX_NAME = 'pesqdf-journals';
const INDEX_NAME = process.env.INDEX_JOURNAL || '';

const configDefault = {
...DefaultQueryConfig(INDEX_NAME),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/patents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const getStaticProps: GetStaticProps<Props> = async ({ locale }) => ({
},
});

const INDEX_NAME = 'pesqdf-patent';
const INDEX_NAME = process.env.INDEX_PATENT || '';

const configDefault = {
...DefaultQueryConfig(INDEX_NAME),
Expand Down
4 changes: 2 additions & 2 deletions src/pages/people.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ import { useTranslation } from 'next-i18next';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import Head from 'next/head';
import { useState } from 'react';
import { containsResults } from '../../utils/Utils';
import CustomSearchBox from '../components/CustomSearchBox';
import DefaultQueryConfig from '../components/DefaultQueryConfig';
import { CustomProvider } from '../components/context/CustomContext';
import CustomResultViewPeople from '../components/customResultView/CustomResultViewPeople';
import CustomViewPagingInfo from '../components/customResultView/CustomViewPagingInfo';
import IndicatorsPeople from '../components/indicators/PeopleIndicators';
import styles from '../styles/Home.module.css';
import { containsResults } from '../../utils/Utils';
type Props = {
// Add custom props here
};
Expand All @@ -36,7 +36,7 @@ export const getStaticProps: GetStaticProps<Props> = async ({ locale }) => ({
},
});

const INDEX_NAME = 'pesqdf-person';
const INDEX_NAME = process.env.INDEX_PERSON || '';
const configDefault = {
...DefaultQueryConfig(INDEX_NAME),
searchQuery: {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/programs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const getStaticProps: GetStaticProps<Props> = async ({ locale }) => ({
},
});

const INDEX_NAME = 'pesqdf-program';
const INDEX_NAME = process.env.INDEX_PROGRAM || '';
const configDefault = {
...DefaultQueryConfig(INDEX_NAME),
searchQuery: {
Expand Down
3 changes: 2 additions & 1 deletion src/pages/publications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export const getServerSideProps: GetServerSideProps<Props> = async ({ locale })
},
});

const INDEX_NAME = 'pesqdf-publication';
const INDEX_NAME = process.env.INDEX_PUBLICATION || '';
console.log('INDEX_PUBLICATION: ', INDEX_NAME);
const configDefault: CustomSearchDriverOptions = {
...DefaultQueryConfig(INDEX_NAME),
searchQuery: {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/software.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const getStaticProps: GetStaticProps<Props> = async ({ locale }) => ({
},
});

const INDEX_NAME = 'pesqdf-software';
const INDEX_NAME = process.env.INDEX_SOFTWARE || '';
const configDefault = {
...DefaultQueryConfig(INDEX_NAME),
searchQuery: {
Expand Down

0 comments on commit 19baabf

Please sign in to comment.