diff --git a/src/components/search/results/variable-view-layout/variable-view-context.tsx b/src/components/search/results/variable-view-layout/variable-view-context.tsx index a9c7210f..a1431038 100644 --- a/src/components/search/results/variable-view-layout/variable-view-context.tsx +++ b/src/components/search/results/variable-view-layout/variable-view-context.tsx @@ -127,7 +127,7 @@ export const VariableViewProvider = ({ children }: VariableViewProviderProps) => const [subsearch, setSubsearch] = useState("") const [sortOption, setSortOption] = useState("score") const [sortOrderOption, setSortOrderOption] = useState("descending") - const [collapseIntoVariables, setCollapseIntoVariables] = useState(true) + const [collapseIntoVariables, setCollapseIntoVariables] = useState(false) const [variableIdMap, studyIdMap] = useMemo<[Map, Map]>(() => { const variableMap = new Map() @@ -198,14 +198,16 @@ export const VariableViewProvider = ({ children }: VariableViewProviderProps) => docs: variableDocs, index: { ref: "id", - fields: ["id", "name", "description"] + fields: ["id", "name", "description", "study_name"] } }), [variableDocs]) const { index, lexicalSearch } = useLunrSearch(lunrConfig) const [filteredVariables, highlightTokens] = useMemo<[VariableResult[], string[]]>(() => { - const { hits, tokens } = lexicalSearch(subsearch) + const { hits, tokens } = lexicalSearch(subsearch, { + fuzziness: (term: string) => 1 + }) const matchedVariables = hits.reduce((acc, { ref: id }) => (acc.add(id), acc), new Set()) const highlightTokens = subsearch.length > 3 ? tokens.map((token) => token.toString()) : []