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

ReactSearchKit: pass initial query state [DEPENDS ON inveniosoftware/react-searchkit#137] #214

Merged
merged 3 commits into from
Oct 9, 2020
Merged

ReactSearchKit: pass initial query state [DEPENDS ON inveniosoftware/react-searchkit#137] #214

merged 3 commits into from
Oct 9, 2020

Conversation

KonstantinaStoikou
Copy link
Contributor

@KonstantinaStoikou KonstantinaStoikou commented Oct 1, 2020

Closes #196
Removes sortOrder dropdown from searches (and merges it with sortBy dropdown) (except for searches that have many date options, e.g. Loans)
Closes #207

Copy link
Member

@FlorianCassayre FlorianCassayre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid it only addresses the issue partly; for instance consider clicking on one of the three button present on the frontsite homepage. Moreover, this was not mentioned in the original issue but it seems all the search forms are affected by this problem (backoffice in particular).

@KonstantinaStoikou
Copy link
Contributor Author

I fixed it for the other searches as well except the document search in the frontsite series details.

Copy link
Contributor

@ntarocco ntarocco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this! IMHO, we need to do some digging in RSK to double check how default values are handled :)

@@ -40,6 +40,8 @@ class Sidebar extends Component {
const checkInActive = activePath.includes(BackOfficeRoutes.checkIn);
const checkOutActive = activePath.includes(BackOfficeRoutes.checkOut);

const query = '&sort=mostrecent&p=1';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issue is that it might be that we have some searches that do not support the mostrecent sorting. Do we really need this?

@@ -51,7 +51,7 @@ const HeadlineLayout = props => {
className="headline-quick-access"
as={Link}
to={FrontSiteRoutes.documentsListWithQuery(
'&sort=mostrecent&order=desc'
'&sort=mostrecent&order=desc&p=1'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think ReactSearchKit has a feature to add default values when not provided, so I am not sure what is wrong here. We need to investigate RSK in my opinion.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would probably go for that too, since the issue can still be reproduced if provided a url without the p=1 parameter; ie. https://localhost:3000/search?q=. Thanks Konstantina for working on it, it's a very annoying issue that has been here for a long time.

@ntarocco
Copy link
Contributor

ntarocco commented Oct 2, 2020

I think the issue is in RSK, this one: inveniosoftware/react-searchkit#110

@KonstantinaStoikou KonstantinaStoikou changed the title HomeSearchBar: fix pagination ReactSearchKit: pass initial query state Oct 6, 2020
@KonstantinaStoikou KonstantinaStoikou changed the title ReactSearchKit: pass initial query state ReactSearchKit: pass initial query state [DEPENDS ON https://github.com/inveniosoftware/react-searchkit/pull/137] Oct 6, 2020
@KonstantinaStoikou KonstantinaStoikou mentioned this pull request Oct 7, 2020
31 tasks
Copy link
Member

@FlorianCassayre FlorianCassayre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the sorting filters it's much more coherent now, good job. Here is some additional context to the issue (Karolina can correct me):

  • By default a sorting filter is a pair of parameters: the field to compare (title, date) and a traversal order (asc, desc)
  • For the frontsite we want this feature to me more user-friendly, therefore instead of having one input for each parameter we provide a unified one which carries both informations at the same time (ie. "Title [A-Z]"). It allows to have an explicit name for the sorting filter and we can also get rid of useless filters that do not belong to any reasonable use case (ie. "Best match + Desc" can be interpreted as "Worst match" which is not very useful...)
  • For the backoffice we would like to allow more flexibility and independence, reason why there are two inputs. However it seems that some search pages have this input while others don't; I think we should stick to the same thing everywhere otherwise I find it confusing

Could you fix this typo by the way? Thanks

defaultValueOnEmptyString={searchConfig.SORT_BY_ON_EMPTY_QUERY}
overridableId="mobile"
/>
<SortBy values={searchConfig.SORT_BY} overridableId="mobile" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the SortBy/SortOrder should completely disappear, in favor of Sort only as in the frontiste. WDYT?

@ntarocco
Copy link
Contributor

ntarocco commented Oct 8, 2020

* For the backoffice we would like to allow more flexibility and independence, reason why there are two inputs. However it seems that some search pages have this input while others don't; I think we should stick to the same thing everywhere otherwise I find it confusing

Yes exactly: @kprzerwa started to move from SortBy+ SortOrder to Sort component only (which combines the 2), but it was too much to apply it everywhere. So she started with frontsite.
Now, @KonstantinaStoikou should apply this to all backoffice too.

It is much easier, IMHO, to use on cmp as you have described then 2.

@FlorianCassayre
Copy link
Member

FlorianCassayre commented Oct 9, 2020

The major fixes were successfully re-tested with dependent PR inveniosoftware/react-searchkit#137. This PR is now waiting for react-searchkit to be released.

Edit: done.

@FlorianCassayre FlorianCassayre changed the title ReactSearchKit: pass initial query state [DEPENDS ON https://github.com/inveniosoftware/react-searchkit/pull/137] ReactSearchKit: pass initial query state [DEPENDS ON inveniosoftware/react-searchkit#137] Oct 9, 2020
KonstantinaStoikou and others added 3 commits October 9, 2020 11:25
* update react-searchkit to 1.0.0-alpha.4
* fix frontsite series cover flickering
* pagination failing when overflowing from the allowed ES window
* removed the last asc/desc inputs in the backoffice
@ntarocco ntarocco merged commit 8c72175 into inveniosoftware:master Oct 9, 2020
@KonstantinaStoikou KonstantinaStoikou deleted the search-bugfixes branch October 12, 2020 07:59
@kpsherva kpsherva added this to the 2020/W40 milestone Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search fails over 10000k results Search: issues with history
4 participants