/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include #include #include #include "LuceneHelper.hxx" #include HelpSearch::HelpSearch(OUString const &indexDir) { OUString ustrSystemPath; osl::File::getSystemPathFromFileURL(indexDir, ustrSystemPath); d_indexDir = OUStringToOString(ustrSystemPath, osl_getThreadTextEncoding()); } void HelpSearch::query(OUString const &queryStr, bool captionOnly, std::vector &rDocuments, std::vector &rScores) { lucene::index::IndexReader *reader = lucene::index::IndexReader::open(d_indexDir.getStr()); lucene::search::IndexSearcher searcher(reader); const TCHAR* field = captionOnly ? L"caption" : L"content"; bool isWildcard = queryStr[queryStr.getLength() - 1] == L'*'; std::vector aQueryStr(OUStringToTCHARVec(queryStr)); lucene::search::Query *pQuery; if (isWildcard) pQuery = _CLNEW lucene::search::WildcardQuery(_CLNEW lucene::index::Term(field, aQueryStr.data())); else pQuery = _CLNEW lucene::search::TermQuery(_CLNEW lucene::index::Term(field, aQueryStr.data())); lucene::search::Hits *hits = searcher.search(pQuery); for (size_t i = 0; i < hits->length(); ++i) { lucene::document::Document &doc = hits->doc(i); // Document* belongs to Hits. wchar_t const *path = doc.get(L"path"); rDocuments.push_back(TCHARArrayToOUString(path != nullptr ? path : L"")); rScores.push_back(hits->score(i)); } _CLDELETE(hits); _CLDELETE(pQuery); reader->close(); _CLDELETE(reader); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ egmerge with uses of unoidl-write, see the changes to odk/examples/ and ure/source/uretext/ in 40f2aee6584eafcf4cd1d95fcf1f775e5435440d "Provide unoidl-write also for the SDK" for examples. * The new types.rdb format is not compatible with LibreOffice < 4.1. Clients generating extensions containing such files are advised to use appropriate LibreOffice-minimal-version elements. * For compatibility with old extensions, reading the legacy types.rdb format is still supported. * The SDK no longer ships an idl/ sub-directory containing the udkap and offapi .idl files (as, unlike idlc, unoidl-write does not need them). odk/config/cfgWin.js had to be adapted to look (somewhat arbitrarily) for an examples/ sub-directory instead of idl/ when checking for "an sdk folder". gb_UnoApi_package_idlfiles became unused and has been removed. * The idlc and regmerge executables have been removed. Module idlc has been removed except for idlc/test/parser/, which is also used by CustomTarget_unoidl/unoidl-write_test, and which may eventually be moved into module unoidl. Module external/ucpp and the corresponding configure options have also been removed. Change-Id: I42a0231699b863b5ebe2bee63bc32c8f79278cc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122363 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Add unoidl-read to the SDK 2022-04-11T13:10:12+00:00 Stephan Bergmann sbergman@redhat.com 2022-04-11T11:16:37+00:00 bb64cd2884beb03a2d578ada10abdb3e0df22778 ...as a replacement for the legacy regview Change-Id: I1e1eecb45f27422727f28feb19c2479af867bd79 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132816 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
...as a replacement for the legacy regview

Change-Id: I1e1eecb45f27422727f28feb19c2479af867bd79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132816
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
unoidl-check does not need to be part of installation sets 2022-04-11T12:12:21+00:00 Stephan Bergmann sbergman@redhat.com 2022-04-11T09:23:18+00:00 77db890a80d62da5524c76addb33e71b3ed9fb6c ...it is a build-time tool used from solenv/gbuild/UnoApiTarget.mk, and should be of no value for users of LO (or of the SDK). It was presumably a historic mistake that its predecessor regcompare was included in installation sets in the first place. (The only mention of it in the Developers' Guide, which only acknowledged its existence without giving any details how to use it, has been removed in <https://wiki.documentfoundation.org/index.php?title=Documentation/DevGuide/Writing_UNO_Components&oldid=492551> "Drop mention of build-time tool unoidl-check that should not be part of any installation sets".) Change-Id: I626e22fa18ad900af150afe29a36aa1ceaf5e259 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132814 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
...it is a build-time tool used from solenv/gbuild/UnoApiTarget.mk, and should
be of no value for users of LO (or of the SDK).  It was presumably a historic
mistake that its predecessor regcompare was included in installation sets in the
first place.  (The only mention of it in the Developers' Guide, which only
acknowledged its existence without giving any details how to use it, has been
removed in
<https://wiki.documentfoundation.org/index.php?title=Documentation/DevGuide/Writing_UNO_Components&oldid=492551>
"Drop mention of build-time tool unoidl-check that should not be part of any
installation sets".)

Change-Id: I626e22fa18ad900af150afe29a36aa1ceaf5e259
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132814
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Provide unoidl-write also for the SDK 2022-02-25T15:46:26+00:00 Stephan Bergmann sbergman@redhat.com 2022-02-22T11:00:00+00:00 40f2aee6584eafcf4cd1d95fcf1f775e5435440d ...after the new types.rdb format that unoidl-write generates has been used internally since LibreOffice 4.1 in 2013; following up on 6db34b6b33ba8e3b13683efd05df8441b87e9c92 "Directly build UNOIDL .rdb files from .idl files" and its "The legacy tools idlc, regcompare, regmerge, and regview are still contained in the URE or SDK for now." The tools idlc and regmerge are deprecated but still shipped in the SDK for now. The plan is to drop them completely for LO 7.5. odk/examples/ and ure/source/uretest/ are adapted to use unoidl-write instead of idlc and regmerge: * unoidl-write does not use a C preprocessor and the # directives in .idl files, it supports reading a single .idl file (containing an arbitrary number of declarations) or a directory tree where each directory corresponds to a UNOIDL module of the same name and each .idl file contains the declaration of the (non-module) UNOIDL entity of the same name. For some of the odk/examples/, that required moving individual .idl files into sub-directories named after the respective modules. In odk/settings/std.mk, definitinos of IDL and REGMERGE have been replaced with a new UNOIDLWRITE. * unoidl-write always enforces reserved UNOIDL identifier restrictions (see 04af4e4f55f3ef319a78edd4d0109e2e7eba90b6 "[API CHANGE] Fix all bad UNOIDL identifiers across offapi" and 620179240670bd00f60555f1f5c5b0268492f97c "Enforce the UNOIDL identifier scheme") (which idlc only enforced optionally with -cid -we). That required renaming "my_module" in odk/examples/DevelopersGuide/Components/CppComponent/. * The new types.rdb format is not compatibly with LibreOffice < 4.1. Clients generating extensions containing such files are advised to use appropriate LibreOffice-minimal-version elements. Change-Id: I1a248fd96e86ecbf407f829bc100d44bfe7f4e7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130533 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
...after the new types.rdb format that unoidl-write generates has been used
internally since LibreOffice 4.1 in 2013; following up on
6db34b6b33ba8e3b13683efd05df8441b87e9c92 "Directly build UNOIDL .rdb files from
.idl files" and its "The legacy tools idlc, regcompare, regmerge, and regview
are still contained in the URE or SDK for now."

The tools idlc and regmerge are deprecated but still shipped in the SDK for now.
The plan is to drop them completely for LO 7.5.

odk/examples/ and ure/source/uretest/ are adapted to use unoidl-write instead of
idlc and regmerge:

* unoidl-write does not use a C preprocessor and the # directives in .idl files,
  it supports reading a single .idl file (containing an arbitrary number of
  declarations) or a directory tree where each directory corresponds to a UNOIDL
  module of the same name and each .idl file contains the declaration of the
  (non-module) UNOIDL entity of the same name.  For some of the odk/examples/,
  that required moving individual .idl files into sub-directories named after
  the respective modules.  In odk/settings/std.mk, definitinos of IDL and
  REGMERGE have been replaced with a new UNOIDLWRITE.

* unoidl-write always enforces reserved UNOIDL identifier restrictions (see
  04af4e4f55f3ef319a78edd4d0109e2e7eba90b6 "[API CHANGE] Fix all bad UNOIDL
  identifiers across offapi" and 620179240670bd00f60555f1f5c5b0268492f97c
  "Enforce the UNOIDL identifier scheme") (which idlc only enforced optionally
  with -cid -we).  That required renaming "my_module" in
  odk/examples/DevelopersGuide/Components/CppComponent/.

* The new types.rdb format is not compatibly with LibreOffice < 4.1.  Clients
  generating extensions containing such files are advised to use appropriate
  LibreOffice-minimal-version elements.

Change-Id: I1a248fd96e86ecbf407f829bc100d44bfe7f4e7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130533
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Untabify odk/util/check.pl 2021-09-14T19:23:36+00:00 Stephan Bergmann sbergman@redhat.com 2021-09-14T15:28:06+00:00 8cbb414ed737f9ffc76e1258e6671769bf63fc6c (trying to change the actual content of those lines would otherwise trigger our "indent with Tab" git commit hook) Change-Id: I97449056eb7850d3993fa5ac565e342d0bcbf200 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122093 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(trying to change the actual content of those lines would otherwise trigger our
"indent with Tab" git commit hook)

Change-Id: I97449056eb7850d3993fa5ac565e342d0bcbf200
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122093
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Fix typos 2019-07-20T20:39:25+00:00 Andrea Gelmini andrea.gelmini@gelma.net 2019-07-20T16:05:48+00:00 dd950a6edbd3abc45409724be8cabe1dee71b63d Change-Id: Ib361243332b7219c0073c787c378c648e44705f2 Reviewed-on: https://gerrit.libreoffice.org/75487 Tested-by: Jenkins Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>
Change-Id: Ib361243332b7219c0073c787c378c648e44705f2
Reviewed-on: https://gerrit.libreoffice.org/75487
Tested-by: Jenkins
Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net>