Skip to content

Commit

Permalink
fix: ne pas afficher les contribs personnalisées (#1478)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-maillot authored Sep 26, 2024
1 parent 1a973aa commit cfd1c8e
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ const AUTOSUGGEST_MAX_RESULTS = 15;

const searchDocumentsQuery = `
query searchDocuments($sources: [String!]! = "", $search: String = "") {
documents(where: {title: {_ilike: $search}, source: {_in: $sources}, _not: {document: {_has_key: "split"}}}, limit: ${AUTOSUGGEST_MAX_RESULTS}) {
documents(
where: {
title: { _ilike: $search }
source: { _in: $sources }
_or: [
{ source: { _neq: "contributions" } }
{ source: { _eq: "contributions" }, document: { _contains: { idcc: "0000" } } }
]
}
limit: ${AUTOSUGGEST_MAX_RESULTS}
) {
source
title
cdtnId: cdtn_id
Expand Down Expand Up @@ -136,6 +146,7 @@ const renderInputComponent = (inputProps) => (
function shouldRenderSuggestions(value) {
return value.trim().length > 2;
}

function renderSectionTitle(section) {
return section.suggestions.length ? (
<Box bg={th.colors.neutral} fontWeight="bold" p={th.space.xxsmall}>
Expand All @@ -154,7 +165,7 @@ const renderSuggestion = (content) => (
<div>
{content.title}
{content.category === "document" && (
<strong> | {getLabelBySource(content.source)}</strong>
<strong> | {getLabelBySource(content.source)}</strong>
)}
</div>
);
Expand Down

0 comments on commit cfd1c8e

Please sign in to comment.