LCOV - code coverage report
Current view: top level - backends/honey - honey_postlisttable.h (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core 954b5873a738 Lines: 7 15 46.7 %
Date: 2019-06-30 05:20:33 Functions: 4 7 57.1 %
Branches: 3 10 30.0 %

           Branch data     Line data    Source code
       1                 :            : /** @file honey_postlisttable.h
       2                 :            :  * @brief Subclass of HoneyTable which holds postlists.
       3                 :            :  */
       4                 :            : /* Copyright (C) 2007,2008,2009,2010,2013,2014,2015,2016,2018 Olly Betts
       5                 :            :  *
       6                 :            :  * This program is free software; you can redistribute it and/or modify
       7                 :            :  * it under the terms of the GNU General Public License as published by
       8                 :            :  * the Free Software Foundation; either version 2 of the License, or
       9                 :            :  * (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_HONEY_POSTLISTTABLE_H
      22                 :            : #define XAPIAN_INCLUDED_HONEY_POSTLISTTABLE_H
      23                 :            : 
      24                 :            : #include <xapian/constants.h>
      25                 :            : #include <xapian/types.h>
      26                 :            : 
      27                 :            : #include "honey_inverter.h"
      28                 :            : #include "honey_postlist.h"
      29                 :            : #include "honey_table.h"
      30                 :            : #include "pack.h"
      31                 :            : 
      32                 :            : #include <string>
      33                 :            : 
      34                 :            : class HoneyDatabase;
      35                 :            : class PostingChanges;
      36                 :            : 
      37                 :        710 : class HoneyPostListTable : public HoneyTable {
      38                 :            :   public:
      39                 :            :     /** Create a new HoneyPostListTable object.
      40                 :            :      *
      41                 :            :      *  This method does not create or open the table on disk - you
      42                 :            :      *  must call the create() or open() methods respectively!
      43                 :            :      *
      44                 :            :      *  @param dbdir        The directory the honey database is stored in.
      45                 :            :      *  @param readonly     true if we're opening read-only, else false.
      46                 :            :      */
      47                 :        354 :     HoneyPostListTable(const std::string & dbdir, bool readonly)
      48         [ +  - ]:        354 :         : HoneyTable("postlist", dbdir + "/postlist.", readonly) { }
      49                 :            : 
      50                 :          1 :     HoneyPostListTable(int fd, off_t offset_, bool readonly)
      51                 :          1 :         : HoneyTable("postlist", fd, offset_, readonly) { }
      52                 :            : 
      53                 :        154 :     bool term_exists(const std::string& term) const {
      54         [ +  + ]:        154 :         return key_exists(pack_honey_postlist_key(term));
      55                 :            :     }
      56                 :            : 
      57                 :            :     HoneyPostList* open_post_list(const HoneyDatabase* db,
      58                 :            :                                   const std::string& term,
      59                 :            :                                   bool need_read_pos) const;
      60                 :            : 
      61                 :            :     void get_freqs(const std::string& term,
      62                 :            :                    Xapian::doccount* termfreq_ptr,
      63                 :            :                    Xapian::termcount* collfreq_ptr) const;
      64                 :            : 
      65                 :            :     void get_used_docid_range(Xapian::doccount doccount,
      66                 :            :                               Xapian::docid& first,
      67                 :            :                               Xapian::docid& last) const;
      68                 :            : 
      69                 :            :     Xapian::termcount get_wdf_upper_bound(const std::string& term) const;
      70                 :            : 
      71                 :          0 :     std::string get_metadata(const std::string& key) const {
      72                 :          0 :         std::string value;
      73 [ #  # ][ #  # ]:          0 :         (void)get_exact_entry(std::string("\0", 2) + key, value);
                 [ #  # ]
      74                 :          0 :         return value;
      75                 :            :     }
      76                 :            : 
      77                 :          0 :     void merge_doclen_changes(const std::map<Xapian::docid,
      78                 :            :                               Xapian::termcount>& changes) {
      79                 :            :         // Honey doesn't support update currently.
      80                 :            :         (void)changes;
      81                 :          0 :     }
      82                 :            : 
      83                 :          0 :     void merge_changes(const std::string& term,
      84                 :            :                        const HoneyInverter::PostingChanges& changes) {
      85                 :            :         // Honey doesn't support update currently.
      86                 :            :         (void)term;
      87                 :            :         (void)changes;
      88                 :          0 :     }
      89                 :            : };
      90                 :            : 
      91                 :            : #endif // XAPIAN_INCLUDED_HONEY_POSTLISTTABLE_H

Generated by: LCOV version 1.11