Support Local Sites in search.
Review Request #7062 — Created March 14, 2015 and submitted
Review requests and users on Local Sites are now indexed. When
searching, the Local Site (or lack thereof) is taken into account, and
only the appropriate results will be returned.There's a
BaseSearchIndex
that all other search indexes must subclass.
This takes care of storing information on the associated local site(s)
in a consistent manner, to ease search queries. If no local sites are
associated with the object being indexed, the list will consist of a
single item:0
. This value indicates no local sites, and is easy to
query. This replaces the need for a separate boolean field. Empty lists
cannot be used, since there's no way to filter on these in any
consistent way across search backends.As part of this, I had to remove usage of Haystack's
search_view_factory
, which doesn't accept URL arguments. We now have our
own wrapper view that constructs theRBSearchView
.This requires a full re-index.
On a non-local site, I tried searching for both non-local site review requests
and local site review requests. Only the ones not on a local site were returned.I repeated the same test when searching on a local site. Only the ones on that
local site were returned.
- Change Summary:
-
- Fixed support for indexing/querying users on Local Sites.
- To ease the maintenance of search indexes with Local Sites, and to keep things consistent, there's now a
BaseSearchIndex
class that takes care of all the Local Site information preparation. It handles objects associated with a singleLocalSite
(like aReviewRequest
) and those with potentially many (User
).
- Description:
-
~ Review requests on Local Sites are now indexed. When searching, the
~ Local Site (or lack thereof) is taken into account, and only the ~ appropriate results will be returned. ~ Review requests and users on Local Sites are now indexed. When
~ searching, the Local Site (or lack thereof) is taken into account, and ~ only the appropriate results will be returned. + + There's a
BaseSearchIndex
that all other search indexes must subclass.+ This takes care of storing information on the associated local site(s) + in a consistent manner, to ease search queries. If no local sites are + associated with the object being indexed, the list will consist of a + single item: 0
. This value indicates no local sites, and is easy to+ query. This replaces the need for a separate boolean field. Empty lists + cannot be used, since there's no way to filter on these in any + consistent way across search backends. As part of this, I had to remove usage of Haystack's
search_view_factory
, which doesn't accept URL arguments. We now have ourown wrapper view that constructs the RBSearchView
.This requires a full re-index.
- Commit:
-
d07fb4002a26cf590d97aeafc1e91b46ba441ef879e7d415b6c108f785100949486972a84022235c
-
Tool: Pyflakes Processed Files: reviewboard/search/indexes.py reviewboard/search/views.py reviewboard/reviews/search_indexes.py reviewboard/reviews/managers.py reviewboard/accounts/search_indexes.py reviewboard/search/urls.py Tool: PEP8 Style Checker Processed Files: reviewboard/search/indexes.py reviewboard/search/views.py reviewboard/reviews/search_indexes.py reviewboard/reviews/managers.py reviewboard/accounts/search_indexes.py reviewboard/search/urls.py
-
- Change Summary:
-
Added a couple blank lines.
- Commit:
-
79e7d415b6c108f785100949486972a84022235ccc05769efe58869779ace9c3ae9371eda521d146
-
Tool: Pyflakes Processed Files: reviewboard/search/indexes.py reviewboard/search/views.py reviewboard/reviews/search_indexes.py reviewboard/reviews/managers.py reviewboard/accounts/search_indexes.py reviewboard/search/urls.py Tool: PEP8 Style Checker Processed Files: reviewboard/search/indexes.py reviewboard/search/views.py reviewboard/reviews/search_indexes.py reviewboard/reviews/managers.py reviewboard/accounts/search_indexes.py reviewboard/search/urls.py