Browse Source

fixes search bug not showing not shared data. this was due to a buggy use of join instead of outerjoin. look at http://stackoverflow.com/questions/448023/what-is-the-difference-between-left-right-outer-and-inner-joins for explanation

root 10 years ago
parent
commit
fe3fd95766
1 changed files with 2 additions and 2 deletions
  1. 2 2
      pboard/pboard/lib/dbapi.py

+ 2 - 2
pboard/pboard/lib/dbapi.py View File

@@ -336,7 +336,7 @@ class PODUserFilteredApiController(object):
336 336
     Returns a list of nodes order by type, nodes which contain at least one of the keywords
337 337
     """
338 338
     liOwnerIdList = self._getUserIdListForFiltering()
339
-
339
+    print ("AGAGA, ", liOwnerIdList)
340 340
     loKeywordFilteringClauses = []
341 341
     for keyword in plKeywordList:
342 342
         loKeywordFilteringClauses.append(pbmd.PBNode.data_label.ilike('%'+keyword+'%'))
@@ -345,7 +345,7 @@ class PODUserFilteredApiController(object):
345 345
 
346 346
     loKeywordFilteringClausesAsOr = sqla.or_(*loKeywordFilteringClauses) # Combine them with or to a BooleanClauseList
347 347
 
348
-    loResultsForSomeKeywords = pbm.DBSession.query(pbmd.PBNode).options(joinedload_all("_lAllChildren")).join(pbma.Rights).join(pbma.user_group_table, pbma.Rights.group_id==pbma.user_group_table.columns['group_id'])\
348
+    loResultsForSomeKeywords = pbm.DBSession.query(pbmd.PBNode).options(joinedload_all("_lAllChildren")).outerjoin(pbma.Rights).outerjoin(pbma.user_group_table, pbma.Rights.group_id==pbma.user_group_table.columns['group_id'])\
349 349
         .filter(loKeywordFilteringClausesAsOr)\
350 350
         .filter((pbmd.PBNode.owner_id.in_(liOwnerIdList)) | (pbma.user_group_table.c.user_id.in_(liOwnerIdList) & pbmd.PBNode.is_shared))\
351 351
         .order_by(sqla.desc(pbmd.PBNode.node_type))\