LCOV - code coverage report
Current view: top level - core/search - SPSearch.scu.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 21 22 95.5 %
Date: 2024-05-12 00:16:13 Functions: 2 2 100.0 %

          Line data    Source code
       1             : /**
       2             : Copyright (c) 2022 Roman Katuntsev <sbkarr@stappler.org>
       3             : Copyright (c) 2023 Stappler LLC <admin@stappler.dev>
       4             : 
       5             : Permission is hereby granted, free of charge, to any person obtaining a copy
       6             : of this software and associated documentation files (the "Software"), to deal
       7             : in the Software without restriction, including without limitation the rights
       8             : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
       9             : copies of the Software, and to permit persons to whom the Software is
      10             : furnished to do so, subject to the following conditions:
      11             : 
      12             : The above copyright notice and this permission notice shall be included in
      13             : all copies or substantial portions of the Software.
      14             : 
      15             : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      16             : IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      17             : FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      18             : AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      19             : LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      20             : OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
      21             : THE SOFTWARE.
      22             : **/
      23             : 
      24             : #include "SPCommon.h"
      25             : #include "SPSearchConfiguration.cc"
      26             : #include "SPSearchDistance.cc"
      27             : #include "SPSearchDistanceEdLib.cc"
      28             : #include "SPSearchIndex.cc"
      29             : #include "SPSearchParser.cc"
      30             : #include "SPSearchQuery.cc"
      31             : #include "SPSearchUrl.cc"
      32             : 
      33             : namespace STAPPLER_VERSIONIZED stappler::search {
      34             : 
      35       81925 : static StemmerEnv *Configuration_makeLocalConfig(StemmerEnv *orig) {
      36       81925 :         auto p = memory::pool::acquire();
      37             : 
      38       81925 :         char buf[24] = { 0 };
      39       81925 :         sprintf(buf, "%#018" PRIxPTR, (uintptr_t)orig);
      40             : 
      41       81925 :         StemmerEnv *ret = nullptr;
      42       81925 :         memory::pool::userdata_get((void **)&ret, buf, p);
      43             : 
      44       81925 :         if (ret) {
      45       81850 :                 return ret;
      46             :         }
      47             : 
      48          75 :         ret = (StemmerEnv *)memory::pool::palloc(p, sizeof(StemmerEnv));
      49          75 :         memset(ret, 0, sizeof(StemmerEnv));
      50          75 :         ret->memalloc = orig->memalloc;
      51          75 :         ret->memfree = orig->memfree;
      52          75 :         ret->userData = p;
      53             : 
      54          75 :         if (auto env = orig->mod->create(ret)) {
      55          75 :                 env->stem = orig->mod->stem;
      56          75 :                 env->stopwords = orig->stopwords;
      57          75 :                 env->mod = orig->mod;
      58          75 :                 memory::pool::userdata_set(env, buf, nullptr, p);
      59          75 :                 return env;
      60             :         }
      61           0 :         return nullptr;
      62             : }
      63             : 
      64       81925 : static void *StemmerEnv_getUserData(StemmerEnv *env) {
      65       81925 :         return env->userData;
      66             : }
      67             : 
      68             : }

Generated by: LCOV version 1.14