marklogic / marklogic/java-client-api

queryManager.uris does not honor additional-query in search options

未关闭
#1,643 7 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

server-bug
主要语言
Java
星标
61
派生
74
平均合并
2 天 53 分钟
30 天内合并 PR
8

描述

Version of MarkLogic Java Client API

6.5.0

Version of MarkLogic Server

11.0.2

Java version

JDK 17

OS and version

ProductName: macOS
ProductVersion: 13.5
BuildVersion: 22G74

Input: Some code to illustrate the problem, preferably in a state that can be independently reproduced on our end

The current issue is a follow-up of this one: https://github.com/marklogic/java-client-api/issues/1640

In the last issue you correctly mentioned that the correct format for search positive/negative is: positive-query and negative-query

However, the way I created the last issue is not 1:1 with the issue that we actually had. Our issue is actually the following:
executing a search query and passing an options name parameter (where the options contains an and-not-query looking for a collection is simply ignored in QueryBatcher, but it works for a simple search).

Let me help you a bit with a piece of code:

QueryManager queryManager= markLogicDatabaseClient.newQueryManager();
        final RawCombinedQueryDefinition structQueryDef = queryManager
            .newRawCombinedQueryDefinition(new StringHandle(
                "<search xmlns=\"http://marklogic.com/appservices/search\">\n" +
			"  <query>\n" +
			"    <and-query>\n" +
			"      <term-query>\n" +
			"        <text>world</text>\n" +
			"      </term-query>\n" +
			"    </and-query>\n" +
			"  </query>\n" +
			"</search>"), "all");

        final SearchHandle result = queryManager.search(structQueryDef, new SearchHandle());
        result.getMatchResults();

The content of "all.xml" contains (between other stuff):

<cts:and-not-query>
	  <cts:annotation type="searchable-collections"/>
	  <cts:positive>
	    <cts:collection-query>
	      <cts:uri>collection1</cts:uri>
	      <cts:uri>collection2</cts:uri>
	    </cts:collection-query>
	  </cts:positive>
	  <cts:negative>
	      <cts:collection-query>
		<cts:uri>ignoredCollection</cts:uri>
	      </cts:collection-query>
	  </cts:negative>
	</cts:and-not-query>
Actual output: What did you observe? What errors did you see? Can you attach the logs? (Java logs, MarkLogic logs)

The output is correct for a simple search, the collections are filtered, but for QueryBatcher they are not.

Expected output: What specifically did you expect to happen?

The output is the same for both search and QueryBatcher (collections are taken into account)

Alternatives: What else have you tried, actual/expected?

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 QueryManager.search 和 QueryBatcher 入口开始,使用提供的 Java 复现代码和 all.xml 中的选项内容。比较简单搜索与 QueryBatcher 中选项名称及其 and-not-query 集合过滤器的应用方式。完成标准是两条路径都返回相同的集合过滤结果,包括排除 ignoredCollection。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
databases
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
52/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。