[JAVA] Let's verify the image search filter

We investigated the behavior of IntAttr and StrAttr added from V2.

Filter using a filter

If you want to use a filter, set the filter condition in setFilter.

request.setFilter("int_attr=10000 AND str_attr=\"Ah ah\"");

Please refer to [Search] for the entire source.

Verification of IntAttr

The int_attr field supports the>,> =, <, <=, = operators.

request.setFilter("int_attr=10000");

Information with an IntAttr value of 10,000 will be hit.

request.setFilter("int_attr<10000");

Information with an IntAttr value less than 10,000 will be hit.

request.setFilter("int_attr>10000");

Information with an IntAttr value greater than 10,000 and data with ** not set (NULL) ** are hit. It is important to note that values that have not been set can be taken.

request.setFilter("int_attr>=10000 AND int_attr<=20000");

Data with IntAttr value of 10,000 or more and 20,000 or less will be hit.

request.setFilter("int_attr=");

An error is returned. The value must be set.

request.setFilter("int_attr<0");

There are 0 hits. Since only integers can be set, nothing will be hit.

request.setFilter("int_attr=30 OR int_attr=100000");

Information with an IntAttr value of 30 or 100,000 will be hit.

request.setFilter("int_attr="+Integer.MAX_VALUE);

Information for which IntAttr is not set is a hit. Apparently, if IntAttr is omitted at the time of registration, the maximum value of Integer is set.

StrAttr validation

The str_attr field supports the =,! = Operators.

request.setFilter("str_attr=\"furniture\"");

Information that exactly matches "furniture" is a hit. The information that set "furniture, desk" was not hit.

request.setFilter("str_attr!=\"Furniture: bookshelf\"");

Information other than the one that exactly matches "furniture" and information for which StrAttr is not set are hit.

request.setFilter("str_attr=\"\"");

Only the information for which StrAttr is not set is hit.

Summary

You need to consider the behavior for data for which no filter conditions have been set. You can get each of them with the above contents, so please set them in the filter conditions. Also, multiple conditions can be set by using "AND" and "OR". IntAttr and StrAttr can also be filtered at the same time.

Recommended Posts

Let's verify the image search filter
Yes, let's preview the image. ~ part5 ~
Image processing: Let's play with the image
Let's understand the function!
Let's grasp the operation image (atmosphere) of the DI container of Spring
Let's make the app better
Let's understand the if statement!
Let's try the S2Struts tutorial (# 3_180425)
Let's solve the roman numerals
Let's understand the guard statement!
Let's try the S2Struts tutorial (# 5_180526)
Let's try the S2Struts tutorial (# 4_180505)
Let's try the S2Struts tutorial (# 1_180423)
Let's solve the FizzBuzz problem!
Let's understand the for-in statement!
Let's try the S2Struts tutorial (# 2_180424)
Let's understand the switch statement!
JavaFX-Load Image in the background
Let's roughly implement the image preview function with Rails + refile + jQuery.