Skip to content

Commit

Permalink
#4051 Fix search extraction for Elastic indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
stroomdev66 committed Mar 12, 2024
1 parent 714af3a commit 413fee7
Show file tree
Hide file tree
Showing 50 changed files with 184 additions and 487 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package stroom.analytics.impl;

import stroom.datasource.api.v2.FieldInfo;
import stroom.datasource.api.v2.FindFieldInfoCriteria;
import stroom.datasource.api.v2.QueryField;
import stroom.docref.DocRef;
Expand Down Expand Up @@ -65,7 +64,7 @@ public AnalyticsSearchProvider(final CoprocessorsFactory coprocessorsFactory,
}

@Override
public ResultPage<FieldInfo> getFieldInfo(final FindFieldInfoCriteria criteria) {
public ResultPage<QueryField> getFieldInfo(final FindFieldInfoCriteria criteria) {
return FieldInfoResultPageBuilder.builder(criteria).addAll(AnalyticFields.getFields()).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import stroom.annotation.shared.EventLink;
import stroom.annotation.shared.SetAssignedToRequest;
import stroom.annotation.shared.SetStatusRequest;
import stroom.datasource.api.v2.FieldInfo;
import stroom.datasource.api.v2.FindFieldInfoCriteria;
import stroom.datasource.api.v2.QueryField;
import stroom.docref.DocRef;
Expand Down Expand Up @@ -59,7 +58,7 @@ public DocRef getDocRef() {
}

@Override
public ResultPage<FieldInfo> getFieldInfo(final FindFieldInfoCriteria criteria) {
public ResultPage<QueryField> getFieldInfo(final FindFieldInfoCriteria criteria) {
return FieldInfoResultPageBuilder.builder(criteria).addAll(AnnotationFields.FIELDS).build();
}

Expand Down
60 changes: 19 additions & 41 deletions stroom-app/src/main/resources/ui/noauth/swagger/stroom.json
Original file line number Diff line number Diff line change
Expand Up @@ -2784,7 +2784,7 @@
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/ResultPageFieldInfo"
"$ref" : "#/components/schemas/ResultPageQueryField"
}
}
},
Expand Down Expand Up @@ -13701,36 +13701,14 @@
"$ref" : "#/components/schemas/DocRef"
},
"field" : {
"$ref" : "#/components/schemas/FieldInfo"
"$ref" : "#/components/schemas/QueryField"
},
"text" : {
"type" : "string"
}
},
"required" : [ "dataSource", "field" ]
},
"FieldInfo" : {
"type" : "object",
"properties" : {
"conditions" : {
"type" : "string",
"enum" : [ "'=', '!=', 'between', '>', '>=', '<', '<='", "'=', '!=', 'in', 'in dictionary', 'between', '>', '>=', '<', '<='", "'=', '!='", "'=', '!=', 'between', '>', '>=', '<', '<='", "'=', '!=', 'in', 'in dictionary'", "'is', 'in folder'", "'=', '!=', 'in', 'in dictionary'", "'is', 'in folder', '=', '!=', 'in', 'in dictionary'", "'=', '!=', 'in', 'in dictionary'", "'=', '!=', '>', '>=', '<', '<=', 'between', 'in', 'in dictionary'", "'=', '!=', 'in', 'in dictionary', 'matches regex'", "'=', '!=', 'in', 'in dictionary'", "'=', '!=', 'in', 'in dictionary'", "'=', '!=', '>', '>=', '<', '<=', 'between', 'in', 'in dictionary'", "'=', '!='", "'=', '!=', '>', '>=', '<', '<=', 'between', 'in', 'in dictionary'", "'=', '!=', 'in', 'in dictionary'", "'is', '=', '!='", "'between'", "'=', '!=', 'in'", "'=', '!=', 'in'", "'=', '!=', 'in', 'in dictionary'", "'=', '!=', 'in', 'in dictionary', 'is'", "'=', '!=', '>', '>=', '<', '<=', 'between', 'in', 'in dictionary'", "'=', '!=', '>', '>=', '<', '<=', 'between', 'in', 'in dictionary'" ]
},
"docRefType" : {
"type" : "string"
},
"fldName" : {
"type" : "string"
},
"fldType" : {
"type" : "string",
"enum" : [ "ID", "BOOLEAN", "INTEGER", "LONG", "FLOAT", "DOUBLE", "DATE", "TEXT", "KEYWORD", "IPV4_ADDRESS", "DOC_REF" ]
},
"queryable" : {
"type" : "boolean"
}
}
},
"Filter" : {
"type" : "object",
"description" : "A pair of regular expression filters (inclusion and exclusion) to apply to the field. Either or both can be supplied",
Expand Down Expand Up @@ -16780,8 +16758,8 @@
}, {
"type" : "object",
"properties" : {
"fieldInfo" : {
"$ref" : "#/components/schemas/FieldInfo"
"field" : {
"$ref" : "#/components/schemas/QueryField"
}
}
} ]
Expand Down Expand Up @@ -17361,21 +17339,6 @@
}
}
},
"ResultPageFieldInfo" : {
"type" : "object",
"description" : "A page of results.",
"properties" : {
"pageResponse" : {
"$ref" : "#/components/schemas/PageResponse"
},
"values" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/FieldInfo"
}
}
}
},
"ResultPageFindInContentResult" : {
"type" : "object",
"description" : "A page of results.",
Expand Down Expand Up @@ -17556,6 +17519,21 @@
}
}
},
"ResultPageQueryField" : {
"type" : "object",
"description" : "A page of results.",
"properties" : {
"pageResponse" : {
"$ref" : "#/components/schemas/PageResponse"
},
"values" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/QueryField"
}
}
}
},
"ResultPageQueryHelpRow" : {
"type" : "object",
"description" : "A page of results.",
Expand Down
79 changes: 14 additions & 65 deletions stroom-app/src/main/resources/ui/noauth/swagger/stroom.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1918,7 +1918,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/ResultPageFieldInfo'
$ref: '#/components/schemas/ResultPageQueryField'
description: default response
summary: Find data source fields
tags:
Expand Down Expand Up @@ -9914,63 +9914,12 @@ components:
dataSource:
$ref: '#/components/schemas/DocRef'
field:
$ref: '#/components/schemas/FieldInfo'
$ref: '#/components/schemas/QueryField'
text:
type: string
required:
- dataSource
- field
FieldInfo:
type: object
properties:
conditions:
type: string
enum:
- "'=', '!=', 'between', '>', '>=', '<', '<='"
- "'=', '!=', 'in', 'in dictionary', 'between', '>', '>=', '<', '<='"
- "'=', '!='"
- "'=', '!=', 'between', '>', '>=', '<', '<='"
- "'=', '!=', 'in', 'in dictionary'"
- "'is', 'in folder'"
- "'=', '!=', 'in', 'in dictionary'"
- "'is', 'in folder', '=', '!=', 'in', 'in dictionary'"
- "'=', '!=', 'in', 'in dictionary'"
- "'=', '!=', '>', '>=', '<', '<=', 'between', 'in', 'in dictionary'"
- "'=', '!=', 'in', 'in dictionary', 'matches regex'"
- "'=', '!=', 'in', 'in dictionary'"
- "'=', '!=', 'in', 'in dictionary'"
- "'=', '!=', '>', '>=', '<', '<=', 'between', 'in', 'in dictionary'"
- "'=', '!='"
- "'=', '!=', '>', '>=', '<', '<=', 'between', 'in', 'in dictionary'"
- "'=', '!=', 'in', 'in dictionary'"
- "'is', '=', '!='"
- '''between'''
- "'=', '!=', 'in'"
- "'=', '!=', 'in'"
- "'=', '!=', 'in', 'in dictionary'"
- "'=', '!=', 'in', 'in dictionary', 'is'"
- "'=', '!=', '>', '>=', '<', '<=', 'between', 'in', 'in dictionary'"
- "'=', '!=', '>', '>=', '<', '<=', 'between', 'in', 'in dictionary'"
docRefType:
type: string
fldName:
type: string
fldType:
type: string
enum:
- ID
- BOOLEAN
- INTEGER
- LONG
- FLOAT
- DOUBLE
- DATE
- TEXT
- KEYWORD
- IPV4_ADDRESS
- DOC_REF
queryable:
type: boolean
Filter:
type: object
description: A pair of regular expression filters (inclusion and exclusion)
Expand Down Expand Up @@ -12800,8 +12749,8 @@ components:
- $ref: '#/components/schemas/QueryHelpData'
- type: object
properties:
fieldInfo:
$ref: '#/components/schemas/FieldInfo'
field:
$ref: '#/components/schemas/QueryField'
QueryHelpFunctionSignature:
type: object
allOf:
Expand Down Expand Up @@ -13414,16 +13363,6 @@ components:
type: array
items:
$ref: '#/components/schemas/Dependency'
ResultPageFieldInfo:
type: object
description: A page of results.
properties:
pageResponse:
$ref: '#/components/schemas/PageResponse'
values:
type: array
items:
$ref: '#/components/schemas/FieldInfo'
ResultPageFindInContentResult:
type: object
description: A page of results.
Expand Down Expand Up @@ -13544,6 +13483,16 @@ components:
type: array
items:
$ref: '#/components/schemas/ProcessorTaskSummary'
ResultPageQueryField:
type: object
description: A page of results.
properties:
pageResponse:
$ref: '#/components/schemas/PageResponse'
values:
type: array
items:
$ref: '#/components/schemas/QueryField'
ResultPageQueryHelpRow:
type: object
description: A page of results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import stroom.dashboard.client.table.TablePresenter;
import stroom.dashboard.shared.ComponentConfig;
import stroom.dashboard.shared.TableComponentSettings;
import stroom.datasource.api.v2.FieldInfo;
import stroom.datasource.api.v2.QueryField;
import stroom.document.client.event.DirtyEvent;
import stroom.document.client.event.DirtyEvent.DirtyHandler;
Expand Down Expand Up @@ -201,7 +200,7 @@ private void add() {
.build();
final RulePresenter editRulePresenter = editRulePresenterProvider.get();
final SimpleFieldSelectionListModel selectionBoxModel = new SimpleFieldSelectionListModel();
selectionBoxModel.addItems(fields.stream().map(FieldInfo::create).collect(Collectors.toList()));
selectionBoxModel.addItems(fields);
editRulePresenter.read(newRule, selectionBoxModel);

final PopupSize popupSize = PopupSize.resizable(800, 550);
Expand All @@ -226,7 +225,7 @@ private void add() {
private void edit(final ConditionalFormattingRule existingRule) {
final RulePresenter editRulePresenter = editRulePresenterProvider.get();
final SimpleFieldSelectionListModel selectionBoxModel = new SimpleFieldSelectionListModel();
selectionBoxModel.addItems(fields.stream().map(FieldInfo::create).collect(Collectors.toList()));
selectionBoxModel.addItems(fields);
editRulePresenter.read(existingRule, selectionBoxModel);

final PopupSize popupSize = PopupSize.resizable(800, 400);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

package stroom.data.client.presenter;

import stroom.datasource.api.v2.FieldInfo;
import stroom.datasource.api.v2.QueryField;
import stroom.dispatch.client.RestFactory;
import stroom.docref.DocRef;
Expand Down Expand Up @@ -62,7 +61,7 @@ public void read(final ExpressionOperator expression,
final List<QueryField> fields) {

final SimpleFieldSelectionListModel fieldSelectionBoxModel = new SimpleFieldSelectionListModel();
fieldSelectionBoxModel.addItems(fields.stream().map(FieldInfo::create).collect(Collectors.toList()));
fieldSelectionBoxModel.addItems(fields);
editExpressionPresenter.init(restFactory, dataSource, fieldSelectionBoxModel);

editExpressionPresenter.read(GwtNullSafe.requireNonNullElseGet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import stroom.alert.client.event.ConfirmEvent;
import stroom.dashboard.shared.ValidateExpressionResult;
import stroom.data.client.presenter.EditExpressionPresenter;
import stroom.datasource.api.v2.FieldInfo;
import stroom.datasource.api.v2.QueryField;
import stroom.dispatch.client.Rest;
import stroom.dispatch.client.RestFactory;
Expand Down Expand Up @@ -69,7 +68,7 @@ public void read(final ExpressionOperator expression,
final Long minMetaCreateTimeMs,
final Long maxMetaCreateTimeMs) {
final SimpleFieldSelectionListModel selectionBoxModel = new SimpleFieldSelectionListModel();
selectionBoxModel.addItems(fields.stream().map(FieldInfo::create).collect(Collectors.toList()));
selectionBoxModel.addItems(fields);
editExpressionPresenter.init(restFactory, dataSource, selectionBoxModel);

if (expression != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package stroom.query.client;

import stroom.datasource.api.v2.FieldInfo;
import stroom.datasource.api.v2.QueryField;
import stroom.dispatch.client.Rest;
import stroom.dispatch.client.RestFactory;
import stroom.docref.DocRef;
Expand All @@ -43,7 +43,7 @@ public class AsyncSuggestOracle extends SuggestOracle {

private RestFactory restFactory;
private DocRef dataSource;
private FieldInfo field;
private QueryField field;
private Timer requestTimer;

public void setRestFactory(final RestFactory restFactory) {
Expand All @@ -54,7 +54,7 @@ public void setDataSource(final DocRef dataSource) {
this.dataSource = dataSource;
}

public void setField(final FieldInfo field) {
public void setField(final QueryField field) {
this.field = field;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package stroom.query.client;

import stroom.datasource.api.v2.FieldInfo;
import stroom.datasource.api.v2.FindFieldInfoCriteria;
import stroom.datasource.api.v2.QueryField;
import stroom.datasource.shared.DataSourceResource;
import stroom.dispatch.client.RestFactory;
import stroom.docref.DocRef;
Expand Down Expand Up @@ -29,18 +29,18 @@ public DataSourceClient(final RestFactory restFactory) {
}

public void findFields(final FindFieldInfoCriteria findFieldInfoCriteria,
final Consumer<ResultPage<FieldInfo>> consumer) {
final Consumer<ResultPage<QueryField>> consumer) {
restFactory
.builder()
.forResultPageOf(FieldInfo.class)
.forResultPageOf(QueryField.class)
.onSuccess(consumer)
.call(DATA_SOURCE_RESOURCE)
.findFields(findFieldInfoCriteria);
}

public void findFieldByName(final DocRef dataSourceRef,
final String fieldName,
final Consumer<FieldInfo> consumer) {
final Consumer<QueryField> consumer) {
if (dataSourceRef != null) {
final FindFieldInfoCriteria findFieldInfoCriteria = new FindFieldInfoCriteria(
new PageRequest(0, 1),
Expand All @@ -49,7 +49,7 @@ public void findFieldByName(final DocRef dataSourceRef,
StringMatch.equals(fieldName, true));
restFactory
.builder()
.forResultPageOf(FieldInfo.class)
.forResultPageOf(QueryField.class)
.onSuccess(result -> {
if (result.getValues().size() > 0) {
consumer.accept(result.getFirst());
Expand Down
Loading

0 comments on commit 413fee7

Please sign in to comment.