Skip to content
Snippets Groups Projects
Commit 7cdcc67d authored by OZGCloud's avatar OZGCloud
Browse files

OZG-3037 auf AND umgestellt

parent 3bbe4bc7
Branches
Tags
No related merge requests found
......@@ -25,7 +25,7 @@ import de.itvsh.ozg.pluto.vorgang.VorgangHeader;
@Repository
class SearchVorgangCustomRepositoryImpl implements SearchVorgangCustomRepostitory {
private static final String JOIN_OR = "OR";
private static final String JOIN_AND = " AND ";
private static final String WILDCARD_PATTERN = "(*%s*)";
private static final String KEYWORD = ".keyword";
private static final float HALF_BOOST = 0.5f;
......@@ -61,7 +61,7 @@ class SearchVorgangCustomRepositoryImpl implements SearchVorgangCustomRepostitor
setFilter(request, searchQueryBuilder);
var queryString = Arrays.stream(request.getQuery().strip().split(StringUtils.SPACE)).map(
WILDCARD_PATTERN::formatted).collect(Collectors.joining(JOIN_OR));
WILDCARD_PATTERN::formatted).collect(Collectors.joining(JOIN_AND));
searchQueryBuilder.withQuery(queryStringQuery(queryString).fields(SearchVorgangCustomRepositoryImpl.FIELD_MAP));
......
......@@ -21,8 +21,6 @@ import de.itvsh.ozg.pluto.command.Command;
import de.itvsh.ozg.pluto.command.CommandService;
import de.itvsh.ozg.pluto.command.CommandTestFactory;
import de.itvsh.ozg.pluto.command.UserTestFactory;
import de.itvsh.ozg.pluto.vorgang.AntragstellerTestFactory;
import de.itvsh.ozg.pluto.vorgang.EingangTestFactory;
import de.itvsh.ozg.pluto.vorgang.FilterCriteriaTestFactory;
import de.itvsh.ozg.pluto.vorgang.FindVorgangRequestTestFactory;
import de.itvsh.ozg.pluto.vorgang.Vorgang.Status;
......@@ -123,18 +121,13 @@ public class SearchServiceITCase {
@Test
void shouldFindByAntragstellerNameAndAktenzeichen() {
searchService.addVorgang(VorgangTestFactory.createBuilder().id(new ObjectId().toHexString()).aktenzeichen("-xyz-")
.eingang(EingangTestFactory.createBuilder().antragsteller(AntragstellerTestFactory.createBuilder().vorname("Peter").build())
.build())
.assignedTo(UUID.randomUUID().toString()).build());
var res = searchService
.find(FindVorgangRequestTestFactory.createBuilder()
.searchBy(IndexedVorgangTestFactory.ANTRAGSTELLER_NAME + " xyz")
.searchBy(IndexedVorgangTestFactory.ANTRAGSTELLER_NAME + " tes")
.filterBy(FilterCriteriaTestFactory.createBuilder().clearStatus().assignedTo(null).build())
.build());
assertThat(res).hasSize(5);
assertThat(res).hasSize(1);
}
@Test
......
......@@ -106,7 +106,7 @@ class SearchVorgangCustomRepositoryImplTest {
var request = SearchRequestTestFactory.createBuilder().query("vors test").build();
var query = searchRepostitory.createQuery(request, PageRequest.of(request.getOffSet(), request.getLimit()));
assertThat(query.getQuery()).asString().contains("\"query\" : \"(*vors*)OR(*test*)\"");
assertThat(query.getQuery()).asString().contains("\"query\" : \"(*vors*) AND (*test*)\"");
}
@Nested
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment