spring-ai icon indicating copy to clipboard operation
spring-ai copied to clipboard

es8的in语法转换问题

Open imp-666 opened this issue 10 months ago • 2 comments

ElasticsearchAiSearchFilterExpressionConverterTest

测试用例

@Test
public void tesIn() {
	String vectorExpr = this.converter.convertExpression(
			new Filter.Expression(IN, new Filter.Key("genre"), new Filter.Value(List.of("comedy", "documentary", "drama")))
	);

// assertThat(vectorExpr).isEqualTo("(metadata.genre:comedy OR documentary OR drama)"); assertThat(vectorExpr).isEqualTo("metadata.genre:(comedy OR documentary OR drama)"); }

这对对于in语法的处理好像有问题吧?

imp-666 avatar Jan 21 '26 02:01 imp-666

I've found that the IN operator in ElasticsearchAiSearchFilterExpressionConverter generates incorrect Lucene syntax. Currently, it produces (field:val1 OR val2) but it should be field:(val1 OR val2) to correctly group the values for the specific field. I'd like to fix this and add a test case for it. Can I take this issue?

Khyojae avatar Jan 24 '26 12:01 Khyojae

This looks resolved: 3d68ffc8e ("GH-5297: Fix Elasticsearch IN/NIN expression grouping syntax"), released in 2.0.0-M3, makes the converter produce metadata.genre:("comedy" OR "documentary" OR "drama"), which ElasticsearchAiSearchFilterExpressionConverterTest#testIn checks. Could this issue be closed?

MusabZafar avatar Nov 30 '26 04:11 MusabZafar