LCOV - code coverage report
Current view: top level - matcher - orpostlist.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core c2b6f1024d3a Lines: 7 7 100.0 %
Date: 2019-05-16 09:13:18 Functions: 2 2 100.0 %
Branches: 5 6 83.3 %

           Branch data     Line data    Source code
       1                 :            : /** @file orpostlist.h
       2                 :            :  * @brief PostList class implementing Query::OP_OR
       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                 :            : #ifndef XAPIAN_INCLUDED_ORPOSTLIST_H
      22                 :            : #define XAPIAN_INCLUDED_ORPOSTLIST_H
      23                 :            : 
      24                 :            : #include "api/postlist.h"
      25                 :            : 
      26                 :            : class PostListTree;
      27                 :            : 
      28                 :            : /// PostList class implementing Query::OP_OR
      29                 :            : class OrPostList : public PostList {
      30                 :            :     /// Don't allow assignment.
      31                 :            :     void operator=(const OrPostList&) = delete;
      32                 :            : 
      33                 :            :     /// Don't allow copying.
      34                 :            :     OrPostList(const OrPostList&) = delete;
      35                 :            : 
      36                 :            :     /** Left side.
      37                 :            :      *
      38                 :            :      *  We optimise assuming this side is more frequent, and so creators should
      39                 :            :      *  try to set this side to the side with the higher estimated term
      40                 :            :      *  frequency.
      41                 :            :      */
      42                 :            :     PostList* l;
      43                 :            : 
      44                 :            :     /// Right side.
      45                 :            :     PostList* r;
      46                 :            : 
      47                 :            :     Xapian::docid l_did = 0;
      48                 :            : 
      49                 :            :     Xapian::docid r_did = 0;
      50                 :            : 
      51                 :            :     double l_max = 0;
      52                 :            : 
      53                 :            :     double r_max = 0;
      54                 :            : 
      55                 :            :     /** Total number of documents in the database. */
      56                 :            :     Xapian::doccount db_size;
      57                 :            : 
      58                 :            :     PostListTree* pltree;
      59                 :            : 
      60                 :            :     PostList* decay_to_and(Xapian::docid did,
      61                 :            :                            double w_min,
      62                 :            :                            bool* valid_ptr = NULL);
      63                 :            : 
      64                 :            :     PostList* decay_to_andmaybe(PostList* left,
      65                 :            :                                 PostList* right,
      66                 :            :                                 Xapian::docid did,
      67                 :            :                                 double w_min,
      68                 :            :                                 bool* valid_ptr = NULL);
      69                 :            : 
      70                 :            :   public:
      71                 :     142695 :     OrPostList(PostList* left, PostList* right,
      72                 :            :                PostListTree* pltree_, Xapian::doccount db_size_)
      73                 :     142695 :         : l(left), r(right), db_size(db_size_), pltree(pltree_)
      74                 :     142695 :     {}
      75                 :            : 
      76                 :     428085 :     ~OrPostList() {
      77         [ +  + ]:     142695 :         delete l;
      78         [ +  + ]:     142695 :         delete r;
      79         [ -  + ]:     285390 :     }
      80                 :            : 
      81                 :            :     Xapian::doccount get_termfreq_min() const;
      82                 :            : 
      83                 :            :     Xapian::doccount get_termfreq_max() const;
      84                 :            : 
      85                 :            :     Xapian::doccount get_termfreq_est() const;
      86                 :            : 
      87                 :            :     TermFreqs get_termfreq_est_using_stats(
      88                 :            :             const Xapian::Weight::Internal& stats) const;
      89                 :            : 
      90                 :            :     Xapian::docid get_docid() const;
      91                 :            : 
      92                 :            :     double get_weight(Xapian::termcount doclen,
      93                 :            :                       Xapian::termcount unique_terms) const;
      94                 :            : 
      95                 :            :     bool at_end() const;
      96                 :            : 
      97                 :            :     double recalc_maxweight();
      98                 :            : 
      99                 :            :     PostList* next(double w_min);
     100                 :            : 
     101                 :            :     PostList* skip_to(Xapian::docid did, double w_min);
     102                 :            : 
     103                 :            :     PostList* check(Xapian::docid did, double w_min, bool& valid);
     104                 :            : 
     105                 :            :     std::string get_description() const;
     106                 :            : 
     107                 :            :     Xapian::termcount get_wdf() const;
     108                 :            : 
     109                 :            :     Xapian::termcount count_matching_subqs() const;
     110                 :            : 
     111                 :            :     void gather_position_lists(OrPositionList* orposlist);
     112                 :            : };
     113                 :            : 
     114                 :            : #endif // XAPIAN_INCLUDED_ORPOSTLIST_H

Generated by: LCOV version 1.11