• 
      

    Use the search index for the search resource when available

    Review Request #9116 — Created Aug. 2, 2017 and submitted

    Information

    Review Board
    release-3.0.x

    Reviewers

    When indexing is enabled, we can use it to perform better full text
    search for review requests and users. Since review groups are not
    indexed, we still have to query the database for them even if search is
    enabled. This does have the side effect that review requests published
    by a user will show up in a search for that user's username, but that is
    a convenient benefit.

    Ran unit tests.

    Description From Last Updated

    Typo in the description: "databse"

    chipx86chipx86

    I know the name existed before, but can we call this reindex_search or something, just so it's a little bit …

    chipx86chipx86

    , optional

    chipx86chipx86

    Do tests depend on these settings after using this context manager? Other tests will already reload the siteconfig, and you …

    chipx86chipx86

    haystack.inputs is in the wrong import group.

    chipx86chipx86

    Rather than have this function, which just appears to be serializing content the right way from the search functions, can …

    chipx86chipx86

    No need for the else. I'd instead say we should have comments within the if above saying that if search …

    chipx86chipx86

    Only one blank line.

    chipx86chipx86

    Trailing newline.

    chipx86chipx86

    E999 SyntaxError: invalid syntax

    reviewbotreviewbot

    F401 'django.db.models.query.QuerySet' imported but unused

    reviewbotreviewbot

    F401 'haystack.inputs.Clean' imported but unused

    reviewbotreviewbot

    F401 'haystack.models.SearchResult' imported but unused

    reviewbotreviewbot

    There's an extra newline here that doesn't make sense. Or perhaps the comment should be moved above FILTER_TYPES?

    daviddavid

    The "however" is awkward. How about just "If search is disabled"

    daviddavid

    Same here.

    daviddavid
    brennie
    chipx86
    1. 
        
    2. Show all issues

      Typo in the description: "databse"

    3. reviewboard/search/testing.py (Diff revision 2)
       
       
      Show all issues

      I know the name existed before, but can we call this reindex_search or something, just so it's a little bit more clear in call sites?

    4. reviewboard/search/testing.py (Diff revision 2)
       
       
      Show all issues

      , optional

    5. reviewboard/search/testing.py (Diff revision 2)
       
       
       
       
       
       
       
       
       
       
      Show all issues

      Do tests depend on these settings after using this context manager? Other tests will already reload the siteconfig, and you shouldn't need to re-fetch the siteconfig, so I think you can basically just set the keys and save.

    6. reviewboard/webapi/resources/search.py (Diff revision 2)
       
       
       
       
      Show all issues

      haystack.inputs is in the wrong import group.

    7. reviewboard/webapi/resources/search.py (Diff revision 2)
       
       
      Show all issues

      Rather than have this function, which just appears to be serializing content the right way from the search functions, can we just return the right data from the beginning in those functions?

    8. reviewboard/webapi/resources/search.py (Diff revision 2)
       
       
       
      Show all issues

      No need for the else. I'd instead say we should have comments within the if above saying that if search is enabled, we'll be making use of the search index for results, and one below the whole new block, explaining that we're falling back to using more restrictive database lookups. It'll help when reading the code.

      Same comments apply below.

    9. reviewboard/webapi/tests/test_search.py (Diff revision 2)
       
       
       
       
       
      Show all issues

      Only one blank line.

    10. reviewboard/webapi/tests/test_search.py (Diff revision 2)
       
       
       
      Show all issues

      Trailing newline.

    11. 
        
    brennie
    Review request changed
    Change Summary:

    Addressed Christian's feedback.

    Description:
       

    When indexing is enabled, we can use it to perform better full text

        search for review requests and users. Since review groups are not
    ~   indexed, we still have to query the databse for them even if search is
      ~ indexed, we still have to query the database for them even if search is
        enabled. This does have the side effect that review requests published
        by a user will show up in a search for that user's username, but that is
        a convenient benefit.

    Checks run (1 failed, 1 succeeded)

    flake8 failed.
    JSHint passed.

    flake8

    brennie
    Review request changed

    Checks run (1 failed, 1 succeeded)

    flake8 failed.
    JSHint passed.

    flake8

    brennie
    david
    1. 
        
    2. reviewboard/search/forms.py (Diff revision 5)
       
       
      Show all issues

      There's an extra newline here that doesn't make sense. Or perhaps the comment should be moved above FILTER_TYPES?

    3. reviewboard/webapi/resources/search.py (Diff revision 5)
       
       
      Show all issues

      The "however" is awkward. How about just "If search is disabled"

    4. reviewboard/webapi/resources/search.py (Diff revision 5)
       
       
      Show all issues

      Same here.

    5. 
        
    brennie
    david
    1. Ship It!
    2. 
        
    brennie
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-3.0.x (2e24fa1)