Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.local.sample
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ REDIS_PREFIX=scix_
# SEARCH
NEXT_PUBLIC_SEARCH_API_TIMEOUT_MS=30000
NEXT_PUBLIC_SEARCH_SSR_API_TIMEOUT_MS=30000
NEXT_PUBLIC_SOLR_HL_MAX_ANALYZED_CHARS=1000000
NEXT_PUBLIC_SOLR_FACET_LIMIT=2000
NEXT_PUBLIC_VIS_RESULTS_GRAPH_ROWS=1500

# CRAWLERS
VERIFIED_BOTS_ACCESS_TOKEN=
Expand Down
10 changes: 5 additions & 5 deletions src/api/search/models.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { APP_DEFAULTS } from '@/config';
import { APP_DEFAULTS, HL_MAX_ANALYZED_CHARS, SOLR_FACET_LIMIT } from '@/config';
import { IADSApiSearchParams, IDocsEntity } from '@/api/search/types';

export const defaultFields: IADSApiSearchParams['fl'] = [
Expand Down Expand Up @@ -194,23 +194,23 @@ export const getSearchFacetYearsParams = (params: IADSApiSearchParams): IADSApiS
'facet.pivot': 'property,year',
facet: true,
'facet.mincount': 1,
'facet.limit': 2000,
'facet.limit': SOLR_FACET_LIMIT,
});

export const getSearchFacetCitationsParams = (params: IADSApiSearchParams): IADSApiSearchParams => ({
...params,
fl: ['id'],
stats: true,
'stats.field': 'citation_count',
'json.facet': `{"citation_count":{"type":"terms","field":"citation_count","sort":{"index":"desc"},"limit":2000}}`,
'json.facet': `{"citation_count":{"type":"terms","field":"citation_count","sort":{"index":"desc"},"limit":${SOLR_FACET_LIMIT}}}`,
});

export const getSearchFacetReadsParams = (params: IADSApiSearchParams): IADSApiSearchParams => ({
...params,
fl: ['id'],
stats: true,
'stats.field': 'read_count',
'json.facet': `{"read_count":{"type":"terms","field":"read_count","sort":{"index":"desc"},"limit":2000}}`,
'json.facet': `{"read_count":{"type":"terms","field":"read_count","sort":{"index":"desc"},"limit":${SOLR_FACET_LIMIT}}}`,
});

export const getSearchStatsParams = (params: IADSApiSearchParams, field: string): IADSApiSearchParams => ({
Expand All @@ -225,7 +225,7 @@ export const getHighlightParams = (params: IADSApiSearchParams): IADSApiSearchPa
fl: ['id'],
hl: true,
'hl.fl': 'title,abstract,body,ack,keyword,author',
'hl.maxAnalyzedChars': 150000,
'hl.maxAnalyzedChars': HL_MAX_ANALYZED_CHARS,
'hl.requireFieldMatch': true,
'hl.usePhraseHighlighter': true,
});
Expand Down
3 changes: 2 additions & 1 deletion src/api/vis/models.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { mapObjIndexed } from 'ramda';
import { IADSApiVisParams, IADSApiWordCloudParams } from './types';
import { IADSApiSearchParams } from '@/api/search/types';
import { VIS_RESULTS_GRAPH_ROWS } from '@/config';

export const defaultResultsGraphParams: IADSApiSearchParams = {
q: '*:*',
sort: ['date desc', 'bibcode desc'],
fl: ['title', 'bibcode', 'citation_count', 'read_count', 'pubdate'],
start: 0,
rows: 1500,
rows: VIS_RESULTS_GRAPH_ROWS,
};

type ParamValueType = IADSApiSearchParams[keyof IADSApiSearchParams];
Expand Down
8 changes: 6 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,18 @@ export const APP_DEFAULTS = {
BIBTEX_DEFAULT_AUTHOR_CUTOFF: 10,
RESULT_ITEM_PUB_CUTOFF: 50,
EMPTY_QUERY: '*:*',
API_TIMEOUT: 30000,
SSR_API_TIMEOUT: 30000,
API_TIMEOUT: parseInt(process.env.NEXT_PUBLIC_SEARCH_API_TIMEOUT_MS ?? '30000', 10),
SSR_API_TIMEOUT: parseInt(process.env.NEXT_PUBLIC_SEARCH_SSR_API_TIMEOUT_MS ?? '30000', 10),
PREFERRED_SEARCH_SORT: 'score',
PREFERRED_LIB_SORT: 'time',
} as const;

export const GOOGLE_RECAPTCHA_KEY = '6Lex_aQUAAAAAMwJFbdGFeigshN7mRQdbXoGQ7-N';

export const HL_MAX_ANALYZED_CHARS = parseInt(process.env.NEXT_PUBLIC_SOLR_HL_MAX_ANALYZED_CHARS ?? '1000000', 10);
export const SOLR_FACET_LIMIT = parseInt(process.env.NEXT_PUBLIC_SOLR_FACET_LIMIT ?? '2000', 10);
export const VIS_RESULTS_GRAPH_ROWS = parseInt(process.env.NEXT_PUBLIC_VIS_RESULTS_GRAPH_ROWS ?? '1500', 10);

export const sessionConfig: IronSessionOptions = {
password: process.env.COOKIE_SECRET,
cookieName: process.env.SCIX_SESSION_COOKIE_NAME,
Expand Down
Loading