Skip to content

Commit

Permalink
Merge pull request #870 from mediacloud/feature-845-improve-query-search
Browse files Browse the repository at this point in the history
add query improvement
  • Loading branch information
Evan-Leon authored Nov 26, 2024
2 parents 6b72e69 + fb8c1b1 commit ed1322c
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions mcweb/frontend/src/features/search/query/querySlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,24 @@ const querySlice = createSlice({
},
addQuery: (state, { payload }) => {
const freezeState = state;
const lastQuery = freezeState[freezeState.length - 1] || {};
freezeState.push(
{
queryString: '',
queryList: [[], [], []],
negatedQueryList: [[], [], []],
platform: payload.platform,
startDate,
endDate: dayjs(latestAllowedEndDate(DEFAULT_PROVIDER)).format('MM/DD/YYYY'),
collections: [],
previewCollections: [],
sources: [],
previewSources: [],
platform: payload.platform || lastQuery.platform || DEFAULT_PROVIDER,
startDate: lastQuery.startDate || startDate,
endDate: lastQuery.endDate || dayjs(latestAllowedEndDate(DEFAULT_PROVIDER)).format('MM/DD/YYYY'),
collections: [...(lastQuery.collections || [])],
previewCollections: [...(lastQuery.previewCollections || [])],
sources: [...(lastQuery.sources || [])],
previewSources: [...(lastQuery.previewSources || [])],
lastSearchTime: dayjs().unix(),
isFromDateValid: true,
isToDateValid: true,
anyAll: 'any',
advanced: payload.advanced,
advanced: payload.advanced || false,
name: 'Query',
edited: false,
},
Expand Down Expand Up @@ -269,4 +270,4 @@ export const {
setInitialSearchTime,
} = querySlice.actions;

export default querySlice.reducer;
export default querySlice.reducer;

0 comments on commit ed1322c

Please sign in to comment.