Skip to content

Commit

Permalink
Context Extraktion für TextId zu Sentence Suche
Browse files Browse the repository at this point in the history
  • Loading branch information
RDBloese committed Aug 5, 2023
1 parent b77446d commit e32140b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/main/java/tla/backend/es/query/SentenceSearchQueryBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import tla.backend.es.model.SentenceEntity;
import tla.backend.es.model.SentenceEntity.Context;
import tla.backend.service.ModelClass;
import tla.domain.command.PassportSpec;

Expand All @@ -20,6 +21,23 @@
public class SentenceSearchQueryBuilder extends ESQueryBuilder implements MultiLingQueryBuilder {

public final static String AGG_ID_TEXT_IDS = "text_ids";

public void setContext(Context context) {
BoolQueryBuilder textQuery = boolQuery();
String textId = context.getTextId();
if (textId != null) {

log.info("sentence query: receive {} text IDs", textId);
textQuery.must(
QueryBuilders.termQuery(
"context.textId",
textId
)
);
this.filter(textQuery);
}

}

public void setTokens(Collection<TokenSearchQueryBuilder> tokenQueries) {
BoolQueryBuilder tokenQuery = boolQuery();
Expand Down

0 comments on commit e32140b

Please sign in to comment.