manticoresoftware / manticoresearch-java

Official Java client for Manticore Search
MIT License
41 stars 5 forks source link

How to add AttrFilters in SearchRequest #21

Closed FriskKiddo closed 8 months ago

FriskKiddo commented 8 months ago

i want to implement the sql: select * from table where a = 'aaa' and b >= 12 and b <= 15

java code: SearchRequest searchRequest = new SearchRequest(); searchRequest.index("table"); EqualsFilter equalsFilter = new EqualsFilter(); equalsFilter.setField("a"); equalsFilter.setValue("aaa"); RangeFilter rangeFilter = new RangeFilter(); rangeFilter.setField("b"); rangeFilter.setGte(new BigDecimal("12")); rangeFilter.setLte(new BigDecimal("15")); searchRequest.setAttrFilter(equalsFilter); // then how to add rangeFilter

FriskKiddo commented 8 months ago

UtilApi can do it

Nick-S-2018 commented 8 months ago

Hi, Currently, Manticore does not allow using multiple attribute filters in one request. If you need to combine different filtering conditions, you should use the 'bool' query instead: https://manual.manticoresearch.com/dev/Searching/Filters#bool-query

sanikolaev commented 8 months ago

Closing as resolved. Feel free to reopen in case you believe there's an issue in the library. Otherwise, please consider using the Discussions instead.