iilyak commented on a change in pull request #1605: Feature/user partitioned 
databases
URL: https://github.com/apache/couchdb/pull/1605#discussion_r224169054
 
 

 ##########
 File path: src/mango/src/mango_idx.erl
 ##########
 @@ -68,13 +70,37 @@ get_usable_indexes(Db, Selector, Opts) ->
     UsableFilter = fun(I) -> is_usable(I, Selector, SortFields) end,
 
     case lists:filter(UsableFilter, UsableIndexes0) of
-        [] -> 
+        [] ->
             ?MANGO_ERROR({no_usable_index, missing_sort_index});
-        UsableIndexes -> 
+        UsableIndexes ->
             UsableIndexes
     end.
 
 
+filter_indexes_by_partitioned(false, Indexes, _PQ) ->
+    Indexes;
+filter_indexes_by_partitioned(DbPartitioned, Indexes, PQ) ->
+    FilterFun = fun (Idx)->
+        PartitionedIdx = case lists:keyfind(partitioned, 1, 
Idx#idx.design_opts) of
 
 Review comment:
   I think this is over-complicated. DbPartitioned is always `true` since we 
have a [dedicated function 
clause](https://github.com/apache/couchdb/pull/1605/files#diff-22a8496294e6d7a845ab05e669c841e0R80).
 Therefore this part can be written as:
   ```
   PartitionedIdx = couch_util:get_value(partitioned, Idx#idx.design_opts, 
true),
   ``` 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to