-
Notifications
You must be signed in to change notification settings - Fork 4
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
Makes the case library searchable #161
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cbothner
force-pushed
the
searchable
branch
9 times, most recently
from
November 1, 2017 19:50
ecf3a36
to
0c0ecb1
Compare
+ Handles disjunction of libraries by slug for now
There is no ActiveRecord API for materialized views, so we need to write raw SQL to make our search index
Includes a materialized view using postgres’s native ts_vectors
This is only necessary until we can upgrade to CircleCI 2.0
While it might seem right not to stem people’s names when building the index, since we’re going to stem the search queries indiscriminately, that’s the only way it will match
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds search to the library. The full text of the cases can be searched, for which the title, dek, kicker, and summary are weighted highest; the titles of pages, podcasts, and activities, and the authors names are weighted second highest; and the contents of paragraphs are weighted third highest. Search is implemented in Postgres with an indexed materialized view of ts_vectors, so it’s really fast.
The search results view is also overloaded as the sub-indexes: while
/catalog/search?libraries[]=michigan
and/catalog/libraries/michigan
show the same cases, the latter also displays a blurb about the MSC Library and functions as its directory page.Migrations: HELL YES
Re: #112