Add search feature #789
Add search feature #789
Conversation
…and Resource models
Currently the given filter is provided as a QuerySet, but the search index saves the curriculum areas for objects (currently only curriculum integrations) as a list of primary keys, but stored as strings rather than integers. This may be due to the way data is stored. Because of this, the logic below must covert the QuerySet of the filter into a list of primary key strings. I also could not get Django/Haystack to filter by checking if any item in the filter was any item in each object in the index. Something similar to the following: search_query_set = search_query_set.filter( curriculum_areas__in=self.cleaned_data["curriculum_areas"] )
Should look into lowering SQL queries to 1 per result object, by making queries in context method.
Bug: Suggestions:
|
Now the last submitted form is used for page navigation.
UI looks GREAT, the page navigation for "go to page: 1 2 3" etc however is a bit broken, I was on page 5 and clicked 1 and it took me to 4, then I clicked page 1 again and the url took me to 5 but it gave me a broken template. |
This allows items to be searched through the text field
</form> | ||
|
||
{% else %} | ||
{# Show some example queries to run, maybe query syntax, something else? #} |
hayleycodes
Jan 22, 2018
Contributor
should this be addressed?....
should this be addressed?....
self.test_data = TopicsTestDataGenerator() | ||
|
||
def test_rebuild_index_command_no_items(self): | ||
management.call_command("rebuild_index", "--noinput") |
hayleycodes
Jan 22, 2018
Contributor
should these methods be asserting something? how does this magic work?
should these methods be asserting something? how does this magic work?
JackMorganNZ
Jan 22, 2018
Author
Member
Address via Slack. Is management called for building search index.
Address via Slack. Is management called for building search index.
@@ -86,6 +86,16 @@ def test_curriculum_areas_undefined(self): | |||
lo_loader.load | |||
) | |||
|
|||
def test_parent_curriculum_area_raises_exception(self): |
hayleycodes
Jan 22, 2018
Contributor
can this be more descriptive? under what condition does it throw an area?
can this be more descriptive? under what condition does it throw an area?
All final fixes are done and I've updated description regarding latest comments. Now ready for testing and review changes. |
This pull request adds search functionality to the website. There is some tiny changes still to make before this is completely finished, but these can be made alongside changes based off code reviews.
Fixes #264.
Features added
Changes made
Final changes to make
Issues to create after PR is merged
optgroup
(see here)Addressed feedback
Fixed by hiding
<select>
elements, though due to using a JS solution, the filters might not appear for a second. However the flicker switch should not occur.Was definitely planned and improved now. Could be improved more in a new PR if needed.
Added context to the breadcrumbs.
Added clear form button.
Fixed.
This is good for accessibility, however I removed the breadcrumbs as they are not needed for this page. I also added placeholder. Keen to discuss this more if you think it requires it.
Added better page navigation.
Fixed.
Added placeholder text.
Will be added in fork of https://github.com/wenzhixin/multiple-select.
Will be added in fork of https://github.com/wenzhixin/multiple-select.