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

Instant Search: Add instant search sorting based on the URL #13377

Merged
merged 21 commits into from
Sep 25, 2019

Conversation

gibrown
Copy link
Member

@gibrown gibrown commented Aug 30, 2019

This PR merges onto the instant-search-master branch.

This is implementing sorting based on the order and orderby params in the URL. We haven't implemented the dropdown yet.

An example url: http://gibrown.wpsandbox.me/main/?s=related&orderby=popularity&order=DESC&blog_id=20115252

And for that Jetpack.com blog_id the results look way better because it removes the recency weighting from http://gibrown.wpsandbox.me/main/?s=related&orderby=relevance&order=DESC&blog_id=20115252

This branch has been rebased on top of #13371 and assumes that will land first.

@gibrown gibrown added [Status] Needs Review To request a review from Crew. Label will be renamed soon. [Feature] Search For all things related to Search Instant Search labels Aug 30, 2019
@gibrown gibrown requested a review from a team as a code owner August 30, 2019 20:30
@gibrown gibrown self-assigned this Aug 30, 2019
@gibrown
Copy link
Member Author

gibrown commented Sep 23, 2019

@jsnmoon I merged this with #13505 so I think it should all be ready to review and merge once that lands.

@gibrown
Copy link
Member Author

gibrown commented Sep 23, 2019

OK, redid the merge. better now

Copy link
Member

@jsnmoon jsnmoon left a comment

Choose a reason for hiding this comment

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

Changes look reasonable and date sorting works as expected.

Not sure if we want to have ascending/descending sorts for results ordered by scores (recency, keyword, and popularity), so I left a comment inline below.

modules/search/instant-search/lib/api.js Outdated Show resolved Hide resolved
sort = 'rating_desc';
}
break;
case 'recency':
Copy link
Member

Choose a reason for hiding this comment

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

Do we not want to have ascending/descending options for results ordered by recency, keyword, popularity, and relevance?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can really only do descending when you sort by any calculated score. Search engines are built to be fast to compute the top results only.

case 'recency':
sort = 'score_recency';
break;
case 'keyword':
Copy link
Member

Choose a reason for hiding this comment

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

This orderby returns a 400; message: "Invalid sort value: score_keyword".

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmmm, ya I guess i disabled that sort method because I wasn't sure if it made sense. Going to leave it in the code here for now. The idea behind it is to have a sorting that is only based on the term and document frequencies in the index.

Co-Authored-By: Jason Moon <4044428+jsnmoon@users.noreply.github.com>
@gibrown gibrown merged commit b94666a into instant-search-master Sep 25, 2019
@gibrown gibrown deleted the add/instant-search-sorting branch September 25, 2019 22:30
@matticbot matticbot added [Status] Needs Changelog and removed [Status] Needs Review To request a review from Crew. Label will be renamed soon. labels Sep 25, 2019
jsnmoon added a commit that referenced this pull request Oct 23, 2019
* Implement minimal search results and spelling correction (#13365)
* Add filtering display (#13371)
* Fix search result display bugs and make improvements (#13393)
* Add rudimentary support for filtering on post types (#13430)
* Add support for filtering on categories and tags (#13505)
* Add instant search sorting based on the URL (#13377)
* Add support for filtering on dates (#13545)
* Add custom taxonomy filtering (#13605)
* add sort widget (#13614)
* fix many theme incompatibilities (#13602)
* Add infinite scrolling (#13684)
* Add caching to the api requests (#13714)
* Clean up some design bugs/issues (#13721)
* Fix labels for post types when we have them. (#13750)
* Add localization and formatting of all dates (#13748)
* search from any page on the site (#13713)
* Hook up default options (inc. sort) (#13742)
* Add TrainTracks analytics (#13730)
* Create PostTypeIcon component (#13790)
* Upgrade to Preact 10 (#13794)
* Add comments component (#13797)
* Address review feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Search For all things related to Search
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants