marklogic-community / data-explorer

Data Explorer Tool
Other
15 stars 4 forks source link

135 - Duplicate fields break search #136

Closed nlaprell closed 6 years ago

nlaprell commented 6 years ago

Validate query/view selected fields and return an error containing a list of any duplicate field names.

cskeefer commented 6 years ago

When making a query, if I leave more than 1 filed set to No (so not in query) then I receive an error message like:

image

Looks like it is because $scope.wizardForm.fields[i-1].title is undefined if the user hasn't selected an include mode so undefined is getting added to dups. We should probably only check the title if the includeMode is not none?

cskeefer commented 6 years ago

Sorry, got click-crazy and click closed on accident

nlaprell commented 6 years ago

@cskeefer - Great catch. I fixed it to prevent processing fields that aren't included in the last commit.

cskeefer commented 6 years ago

@nlaprell looks good but I did notice a side effect of the fix when testing. To recreate do the following:

It seems like, when creating a query, the backend expects all fields to be passed to it (regardless of if the field is to be included in the search, display, or both). But now it looks like we're just passing the fields that have an includeMode != none. Maybe just use the new includeMode test for dups rather than for also determining what fields get sent to the backend?

nlaprell commented 6 years ago

@cskeefer - Yeah, looks like I was skipping past setting the fields in the loop if it wasn't included, when I should have just wrapped the dupe logic. Fixed in the last commit. Thanks!