0
SearchUtil.search(
                Collections.emptyMap(),
                booleanQuery -> {
                    BooleanFilter booleanFilter =
                            booleanQuery.getPreBooleanFilter();
                    booleanFilter.add(
                            new TermFilter(Field.GROUP_ID, String.valueOf(siteId)),
                            BooleanClauseOccur.MUST);
                    booleanFilter.add(
                            new TermFilter(Field.ENTRY_CLASS_NAME, JournalArticle.class.getName()),
                            BooleanClauseOccur.MUST);
                },
                filter, JournalArticle.class, search, pagination,
                queryConfig -> queryConfig.setSelectedFieldNames(
                        Field.ARTICLE_ID),
                searchContext -> {
                    searchContext.setVulcanCheckPermissions(true);
                    searchContext.addVulcanAggregation(aggregation);
                    searchContext.setCompanyId(companyId);
                    searchContext.setAttribute("ddmStructureKey", "myDDMStructure");
                },
                sort,
                document -> MyParserUtil.wrapArticle(JournalArticleServiceUtil.getArticle(siteId, document.get(Field.ARTICLE_ID)))
        );

This is my code, I have issue regarding search. At the moment, search is working with FULL-TEXT like I want but it looks all fields in JournalArticle table and also all fields inside content field (DDMStructure).

I want to limit search to look only fields Title and Description inside Content (DDMStructure).

I tried with this:

QueryFilter query = ddmIndexer.createFieldValueQueryFilter(myDDMStructure, MyDDMStructure.Description.name(), contextCompany.getLocale(), search);

and adding it inside booleanQuery.add(query, BooleanClauseOccur.MUST) but in that case if my description is "My Description Test" and search is "My Description XXXX", it wont match because the third word is not matching. I want to look at it as a FULL-TEXT index and to give best results (thats how it works without this additional query.

I tried with DDMIndexer and I am getting some progress but its still not what I am looking for. I described in previous section in detail. I already saw some comments with documentation links, some of them pages are removed and some of them I tried but i did not get what I want.

Nikola
  • 1

0 Answers0