I am developing a search and the search should operate only on two columns aka "name" and "alternate". The search Widget as Coded using ArcGIS JavaScript API 4.22:
const source: any[] = []; searchConfig.sources.forEach((sourceItem) => { source.push({ layer: new FeatureLayer({ url: sourceItem.url, outFields: ['*'], }), searchFields: ["name", "alternate"], displayField: "name", exactMatch: true, outFields: ["name", "alternate"], name: "source layer" placeholder: "whoop", suggestionTemplate: "Name: {name}", maxResults: 5, suggestionsEnabled: false, }); }); const searchWidget = new Search({ view: stores.mapStore.mapView, allPlaceholder: 'quickSearch', sources: [], searchAllEnabled: true, locationEnabled: false, includeDefaultSources: false, }); searchWidget.set('sources', source);
Unfortunately the GET call also searches for the objectid:
GET HTTP://URL_TO_FEATURESERVER/1/query?f=pbf&maxAllowableOffset=1&resultRecordCount=1&where=(name = 68) OR (alternate = '68') OR (objectid = 68)&outFields=name,alternate,objectid&outSR=102100&spatialRel=esriSpatialRelIntersects&token=MYCOOLTOKEN
I want to remove "objectid" from the fields to be searched.
How can I do this?
I have tried a bunch of variations of of this and cannot replicate this behavior. If you provide a codepen or simplified github sample, could better help, but not sure otherwise.
This is practically identical to this post. Have you tried the solution proposed there?
Sorry, wrong URL...I meant this one.
I think @JoelBennett's post in the other thread addresses this question.