1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <rtl/string.hxx>
21 #include <osl/file.hxx>
22 #include <db/Block.hxx>
23 #include <db/BtreeDictParameters.hxx>
24 #include <db/BtreeDict.hxx>
25 #include <util/RandomAccessStream.hxx>
26 #include <db/DBEnv.hxx>
27 #include <qe/QueryProcessor.hxx>
30 #include <abidebug.hxx>
34 using namespace xmlsearch::util
;
35 using namespace xmlsearch::db
;
36 using namespace xmlsearch::qe
;
40 extern RandomAccessStream
* theFile();
44 void print_rtl_OUString( const OUString bla
)
46 OString bluber
= OString( bla
.getStr(),bla
.getLength(),RTL_TEXTENCODING_UTF8
);
47 char* bluberChr
= new char[ 1+bluber
.getLength() ];
48 const sal_Char
* jux
= bluber
.getStr();
50 for( int i
= 0; i
< bluber
.getLength(); ++i
)
51 bluberChr
[i
] = jux
[i
];
53 bluberChr
[ bluber
.getLength() ] = 0;
54 printf( "%s\n",bluberChr
);
63 int main( int argc
,char* argv
[] )
66 QueryResults
* queryResults
= 0;
70 OUString
installDir("//./e|/index/");
71 QueryProcessor
queryProcessor( installDir
);
73 std::vector
<OUString
> Query(2);
75 Query
[1] = "abbildung";
76 OUString Scope
= "headingheading";
79 QueryStatement
queryStatement( HitCount
,Query
,Scope
);
80 queryResults
= queryProcessor
.processQuery( queryStatement
);
82 OUString translations
[2];
83 translations
[0] = "#HLP#";
84 translations
[1] = "vnd.sun.star.help://";
86 PrefixTranslator
* translator
= PrefixTranslator::makePrefixTranslator( translations
,2 );
88 QueryHitIterator
* it
= queryResults
->makeQueryHitIterator();
90 while( j
< 10 && it
->next() )
92 printf( "Ergebnis %2d ",j
);
93 QueryHitData
* qhd
= it
->getHit( translator
);
94 printf( "Penalty = %10.4f ",qhd
->getPenalty() );
95 print_rtl_OUString( qhd
->getDocument() );
103 printf( "catched exception" );
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */