Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter being removed #326

Open
leaelhage opened this issue Mar 22, 2022 · 2 comments
Open

Filter being removed #326

leaelhage opened this issue Mar 22, 2022 · 2 comments

Comments

@leaelhage
Copy link

I have set a filter for Language instead of having a dynamic filter since the user would have to select a filter after every search

<DiscoverySearch
                searchClient={searchClient}
                projectId={projectId}
                count={10}
                overrideQueryParameters={{
                  filter:`metadata.Language:${lang}`,
                  passages: {
                    enabled: true,
                    max_per_document: 5,
                    characters: 325,
                    find_answers: true,
                    max_answers_per_passage: 5
                  },
                  _return: ['document_passages', 'metadata', 'extracted_metadata', 'html', 'result_metadata',
                  'Description', 'Target_Lines_of_Business', 'Path', 'Modified', 'Content_Type', 'Title', 'Form_Number']
                }}

What I notice is when I hit enter on a query the filter isnt taken in consideration. If possible to provide guidance I'm trying to understand the backwardsCompatibleSearchParameters since I'm seeing that this might be the cause of the change.

-------currentSearchParameters
{projectId: '', filter: 'metadata.Language:English', passages: {…}, _return: Array(12), naturalLanguageQuery: 'tax', …}
count: 10
filter: "metadata.Language:English"
naturalLanguageQuery: "tax"
passages: {enabled: true, max_per_document: 5, characters: 325, find_answers: true, max_answers_per_passage: 5}
projectId: ""
spellingSuggestions: true
_return: (12) ['document_passages', 'metadata', 'extracted_metadata', 'html', 'result_metadata', 'Description', 'Target_Lines_of_Business', 'Path', 'Modified', 'Content_Type', 'Title', 'Form_Number']

-------backwardsCompatibleSearchParameter
{projectId: '', filter: '', passages: {…}, _return: Array(12), naturalLanguageQuery: 'tax', …}
count: 10
filter: ""
naturalLanguageQuery: "tax"
offset: 0
passages: {enabled: true, max_per_document: 5, characters: 325, find_answers: true, max_answers_per_passage: 5}
projectId: ""
spellingSuggestions: true
_return: (12) ['document_passages', 'metadata', 'extracted_metadata', 'html', 'result_metadata', 'Description', 'Target_Lines_of_Business', 'Path', 'Modified', 'Content_Type', 'Title', 'Form_Number']

@jhpedemonte
Copy link
Member

I was able to reproduce. The filter string is getting overridden in https://github.com/watson-developer-cloud/discovery-components/blob/v1.5.0-beta.30/packages/discovery-react-components/src/components/DiscoverySearch/DiscoverySearch.tsx#L455. But I'm not exactly sure why that code is written that way. Still investigating.

@MarzlS
Copy link

MarzlS commented Jul 11, 2023

I think any filter that has been set is overwritten upon search in line

as the "resetAggregations" flag is always true here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants