Skip to content

Commit

Permalink
ensure boolean shows up correctly.no sorting by feature importance
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarezmelissa87 committed Apr 16, 2020
1 parent 4f834cc commit e825faa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ interface Props {
export const ResultsTable: FC<Props> = React.memo(
({ indexPattern, jobConfig, jobStatus, setEvaluateSearchQuery }) => {
const needsDestIndexFields = indexPattern && indexPattern.title === jobConfig.source.index[0];

const resultsField = jobConfig.dest.results_field;
const {
errorMessage,
fieldTypes,
Expand Down Expand Up @@ -93,6 +93,7 @@ export const ResultsTable: FC<Props> = React.memo(
// Built-in values are ['boolean', 'currency', 'datetime', 'numeric', 'json']
// To fall back to the default string schema it needs to be undefined.
let schema;
let isSortable = true;
const type = fieldTypes[field];
const isNumber =
type !== undefined &&
Expand All @@ -109,9 +110,16 @@ export const ResultsTable: FC<Props> = React.memo(
case 'geo_point':
schema = 'json';
break;
case 'boolean':
schema = 'boolean';
break;
}

if (field === `${resultsField}.feature_importance`) {
isSortable = false;
}

return { id: field, schema };
return { id: field, schema, isSortable };
});

const docFieldsCount = tableFields.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
DataFrameAnalyticsConfig,
EsFieldName,
INDEX_STATUS,
SEARCH_SIZE,
} from '../../../../common';
import { Dictionary } from '../../../../../../../common/types/common';
import { isKeywordAndTextType } from '../../../../common/fields';
Expand Down Expand Up @@ -188,7 +187,6 @@ export const useExploreData = (

const resp: SearchResponse7 = await ml.esSearch({
index: jobConfig.dest.index,
size: SEARCH_SIZE,
body: {
query,
from: pageIndex * pageSize,
Expand Down

0 comments on commit e825faa

Please sign in to comment.