<div dir="ltr"><div>Ack! It was very close. Note the "[query]" in the return. It's expecting the OR statements to be wrapped like: "['or', ... field 1 ... , ... field 2...]":</div><div><br></div><div> prepareFields: function (fields) {<br> // reformat the fields for the query engine,<br> // "*stuff*" will do a case-ignored "contains" query.<br> var query = ['or'];<br> for(var i = 0, ii = fields.length; i < ii; i++) {<br> if(fields[i].value !== '' && fields[i].value !== undefined) {<br> query.push({<br> comparitor: 'ilike',<br> name: fields[i].name,<br> value: '%' + fields[i].value + '%'<br> });<br> }<br> }<br> return [query];<br> }</div><div><br></div><div>See the Gist here: <a href="https://gist.github.com/theduckylittle/c659413dc4fdcbcd793bd2148202332f">https://gist.github.com/theduckylittle/c659413dc4fdcbcd793bd2148202332f</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 11, 2020 at 6:28 PM Christopher Hughes <<a href="mailto:chughes@co.lincoln.or.us">chughes@co.lincoln.or.us</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Dan,<input name="virtru-metadata" type="hidden" value="{"email-policy":{"state":"closed","expirationUnit":"days","disableCopyPaste":false,"disablePrint":false,"disableForwarding":false,"enableNoauth":false,"persistentProtection":false,"expandedWatermarking":false,"expires":false,"isManaged":false},"attachments":{},"compose-id":"7","compose-window":{"secure":false}}"><div><br></div><div>I'm having trouble getting this working. I've tried several combinations of the code below. When I omit the fields parameter at the end there's no box to input a search,</div><div>but with it I'm unsure about how to adjust it for searching multiple fields. Depending on how what I try I either get a comparitor error or an error saying prepareFields/queryFields</div><div>isn't defined. Do you have any ideas?</div><div><br></div><div>Working in the demo:</div><div>app.registerService('search', SearchService, {<br> <br> prepareFields: function(fields) {<br> var query = ['or']; // adding or to the beginning should make it conditional.<br> var queryFields = ['OWNER_NAME', 'OWN_ADD_L1', 'OWN_ADD_L3'];<br> var searchValue = fields[0].value;<br> for(var i = 0, ii = queryFields.length; i < ii; i++) {<br> query.push({<br> comparitor: 'ilike',<br> name:queryFields[i],<br> value: '%' + searchValue + '%'<br> });<br> }<br> return query;<br> },<br> fields: [<br> {type: 'text', label: 'City/State/ZIP', name: 'prepareFields'}<br> ],<br> searchLayers: ['vector-parcels/parcels']<br><br><br>});<br></div><div><br></div><div><br></div><div>Thanks,</div><div>Chris</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 6, 2020 at 3:07 PM Dan Little <<a href="mailto:theduckylittle@gmail.com" target="_blank">theduckylittle@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto">Pass it in as an option on app.js. </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Feb 6, 2020, 18:04 Christopher Hughes <<a href="mailto:chughes@co.lincoln.or.us" target="_blank">chughes@co.lincoln.or.us</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi Dan,<div><br></div><div>Do you mean changing this in the search.js file or trying to overwrite this in app.js when creating the individual search service?</div><div><br></div><div>Thanks,</div><div><br></div><div>Chris</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 5, 2020 at 6:42 AM Dan Little <<a href="mailto:theduckylittle@gmail.com" rel="noreferrer" target="_blank">theduckylittle@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Chirs,</div><div><br></div><div>You can make that happen by overriding "prepareFields" in the options.</div><div><br></div><div>This is a little rough and untested but I believe this would do it:</div><div><br></div><div>prepareFields: function(fields) {</div><div> var query = ['or']; // adding or to the beginning should make it conditional.</div><div> var queryFields = ['PIN', 'NAME', 'STREETNAME'];</div><div> var searchValue = fields[0].value;<br></div><div> for(var i = 0, ii = queryFields.length; i < ii; i++) {<br> query.push({<br> comparitor: 'ilike',<br> name:queryFields[i],<br> value: '%' + searchValue + '%'<br> });<br> }<br> return query;<br></div><div> };</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 4, 2020 at 3:33 PM Christopher Hughes <<a href="mailto:chughes@co.lincoln.or.us" rel="noreferrer" target="_blank">chughes@co.lincoln.or.us</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Does anyone know if there's a way to configure a search service in geomoose 3 that searches<div>over multiple fields in a single box?</div><div><br></div><div>I'd like to be able to configure a simple search that allows users to enter information in a single box</div><div>and find results that match information in any of the fields you specify. This way they don't need to </div><div>know as much about how your data is organized. My current workaround is to just create a new </div><div>dataset that has all the fields I want, concatenated into a single field, and set geomoose to search </div><div>that in the service. This gets the job done but I'd rather not modify the data if I don't have to.</div><div><br></div><div>Thanks,</div><div><br></div><div>Chris<br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><font size="4">Chris Hughes</font><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">GIS Analyst</div><div style="font-size:12.8px"><font size="1">Lincoln County Surveyor Department </font></div><div><font size="1"><span style="font-family:Roboto,arial,sans-serif">880 NE 7th S</span><span style="font-family:Roboto,arial,sans-serif">t</span>. l Newport, OR 97365</font></div><div style="font-size:12.8px"><font size="1">Tel: (541) 574 1283</font></div></div></div></div></div>
_______________________________________________<br>
Geomoose-users mailing list<br>
<a href="mailto:Geomoose-users@lists.osgeo.org" rel="noreferrer" target="_blank">Geomoose-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/geomoose-users" rel="noreferrer noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/geomoose-users</a></blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><font size="4">Chris Hughes</font><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">GIS Analyst</div><div style="font-size:12.8px"><font size="1">Lincoln County Surveyor Department </font></div><div><font size="1"><span style="font-family:Roboto,arial,sans-serif">880 NE 7th S</span><span style="font-family:Roboto,arial,sans-serif">t</span>. l Newport, OR 97365</font></div><div style="font-size:12.8px"><font size="1">Tel: (541) 574 1283</font></div></div></div></div>
</blockquote></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><font size="4">Chris Hughes</font><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">GIS Analyst</div><div style="font-size:12.8px"><font size="1">Lincoln County Surveyor Department </font></div><div><font size="1"><span style="font-family:Roboto,arial,sans-serif">880 NE 7th S</span><span style="font-family:Roboto,arial,sans-serif">t</span>. l Newport, OR 97365</font></div><div style="font-size:12.8px"><font size="1">Tel: (541) 574 1283</font></div></div></div></div>
</blockquote></div>