LCOV - code coverage report
Current view: top level - matcher - deciderpostlist.cc (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core fcfb185a9dd5 Lines: 9 14 64.3 %
Date: 2019-04-18 16:33:14 Functions: 1 2 50.0 %
Branches: 2 10 20.0 %

           Branch data     Line data    Source code
       1                 :            : /** @file deciderpostlist.cc
       2                 :            :  * @brief PostList which applies a MatchDecider
       3                 :            :  */
       4                 :            : /* Copyright 2017 Olly Betts
       5                 :            :  *
       6                 :            :  * This program is free software; you can redistribute it and/or
       7                 :            :  * modify it under the terms of the GNU General Public License as
       8                 :            :  * published by the Free Software Foundation; either version 2 of the
       9                 :            :  * License, or (at your option) any later version.
      10                 :            :  *
      11                 :            :  * This program is distributed in the hope that it will be useful,
      12                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14                 :            :  * GNU General Public License for more details.
      15                 :            :  *
      16                 :            :  * You should have received a copy of the GNU General Public License
      17                 :            :  * along with this program; if not, write to the Free Software
      18                 :            :  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
      19                 :            :  */
      20                 :            : 
      21                 :            : #include <config.h>
      22                 :            : 
      23                 :            : #include "deciderpostlist.h"
      24                 :            : 
      25                 :            : #include "omassert.h"
      26                 :            : #include <xapian/matchdecider.h>
      27                 :            : 
      28                 :            : bool
      29                 :       5934 : DeciderPostList::test_doc()
      30                 :            : {
      31                 :            :     // We know that doc holds a ValueStreamDocument.
      32                 :       5934 :     Xapian::Document::Internal* doc_int = doc.internal.get();
      33                 :       5934 :     ValueStreamDocument* vsdoc = static_cast<ValueStreamDocument*>(doc_int);
      34                 :            : 
      35                 :       5934 :     vsdoc->set_shard_document(pl->get_docid());
      36                 :            : 
      37                 :       5934 :     bool decision = (*decider)(doc);
      38         [ +  + ]:       5934 :     if (decision) {
      39                 :        147 :         ++decider->docs_allowed_;
      40                 :            :     } else {
      41                 :       5787 :         ++decider->docs_denied_;
      42                 :            :     }
      43                 :       5934 :     return decision;
      44                 :            : }
      45                 :            : 
      46                 :            : string
      47                 :          0 : DeciderPostList::get_description() const
      48                 :            : {
      49         [ #  # ]:          0 :     string desc = "DeciderPostList(";
      50 [ #  # ][ #  # ]:          0 :     desc += pl->get_description();
      51         [ #  # ]:          0 :     desc += ')';
      52                 :          0 :     return desc;
      53                 :            : }

Generated by: LCOV version 1.11