[Geomoose-users] GeoMoose 3 - Search

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Geomoose-users] GeoMoose 3 - Search

chughes
Does anyone know if there's a way to configure a search service in geomoose 3 that searches
over multiple fields in a single box?

I'd like to be able to configure a simple search that allows users to enter information in a single box
and find results that match information in any of the fields you specify. This way they don't need to 
know as much about how your data is organized. My current workaround is to just create a new 
dataset that has all the fields I want, concatenated into a single field, and set geomoose to search 
that in the service. This gets the job done but I'd rather not modify the data if I don't have to.

Thanks,

Chris

--
Chris Hughes

GIS Analyst
Lincoln County Surveyor Department 
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283

_______________________________________________
Geomoose-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geomoose-users
Reply | Threaded
Open this post in threaded view
|

Re: [Geomoose-users] GeoMoose 3 - Search

Dan Little-2
Hi Chirs,

You can make that happen by overriding "prepareFields" in the options.

This is a little rough and untested but I believe this would do it:

prepareFields: function(fields) {
        var query = ['or']; // adding or to the beginning should make it conditional.
       var queryFields = ['PIN', 'NAME', 'STREETNAME'];
        var searchValue = fields[0].value;
        for(var i = 0, ii = queryFields.length; i < ii; i++) {
                query.push({
                    comparitor: 'ilike',
                    name:queryFields[i],
                    value: '%' + searchValue + '%'
                });
        }
        return query;
    };

On Tue, Feb 4, 2020 at 3:33 PM Christopher Hughes <[hidden email]> wrote:
Does anyone know if there's a way to configure a search service in geomoose 3 that searches
over multiple fields in a single box?

I'd like to be able to configure a simple search that allows users to enter information in a single box
and find results that match information in any of the fields you specify. This way they don't need to 
know as much about how your data is organized. My current workaround is to just create a new 
dataset that has all the fields I want, concatenated into a single field, and set geomoose to search 
that in the service. This gets the job done but I'd rather not modify the data if I don't have to.

Thanks,

Chris

--
Chris Hughes

GIS Analyst
Lincoln County Surveyor Department 
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283
_______________________________________________
Geomoose-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geomoose-users

_______________________________________________
Geomoose-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geomoose-users
Reply | Threaded
Open this post in threaded view
|

Re: [Geomoose-users] GeoMoose 3 - Search

chughes
Hi Dan,

Do you mean changing this in the search.js file or trying to overwrite this in app.js when creating the individual search service?

Thanks,

Chris

On Wed, Feb 5, 2020 at 6:42 AM Dan Little <[hidden email]> wrote:
Hi Chirs,

You can make that happen by overriding "prepareFields" in the options.

This is a little rough and untested but I believe this would do it:

prepareFields: function(fields) {
        var query = ['or']; // adding or to the beginning should make it conditional.
       var queryFields = ['PIN', 'NAME', 'STREETNAME'];
        var searchValue = fields[0].value;
        for(var i = 0, ii = queryFields.length; i < ii; i++) {
                query.push({
                    comparitor: 'ilike',
                    name:queryFields[i],
                    value: '%' + searchValue + '%'
                });
        }
        return query;
    };

On Tue, Feb 4, 2020 at 3:33 PM Christopher Hughes <[hidden email]> wrote:
Does anyone know if there's a way to configure a search service in geomoose 3 that searches
over multiple fields in a single box?

I'd like to be able to configure a simple search that allows users to enter information in a single box
and find results that match information in any of the fields you specify. This way they don't need to 
know as much about how your data is organized. My current workaround is to just create a new 
dataset that has all the fields I want, concatenated into a single field, and set geomoose to search 
that in the service. This gets the job done but I'd rather not modify the data if I don't have to.

Thanks,

Chris

--
Chris Hughes

GIS Analyst
Lincoln County Surveyor Department 
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283
_______________________________________________
Geomoose-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geomoose-users


--
Chris Hughes

GIS Analyst
Lincoln County Surveyor Department 
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283

_______________________________________________
Geomoose-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geomoose-users
Reply | Threaded
Open this post in threaded view
|

Re: [Geomoose-users] GeoMoose 3 - Search

Dan Little-2
Pass it in as an option on app.js. 

On Thu, Feb 6, 2020, 18:04 Christopher Hughes <[hidden email]> wrote:
Hi Dan,

Do you mean changing this in the search.js file or trying to overwrite this in app.js when creating the individual search service?

Thanks,

Chris

On Wed, Feb 5, 2020 at 6:42 AM Dan Little <[hidden email]> wrote:
Hi Chirs,

You can make that happen by overriding "prepareFields" in the options.

This is a little rough and untested but I believe this would do it:

prepareFields: function(fields) {
        var query = ['or']; // adding or to the beginning should make it conditional.
       var queryFields = ['PIN', 'NAME', 'STREETNAME'];
        var searchValue = fields[0].value;
        for(var i = 0, ii = queryFields.length; i < ii; i++) {
                query.push({
                    comparitor: 'ilike',
                    name:queryFields[i],
                    value: '%' + searchValue + '%'
                });
        }
        return query;
    };

On Tue, Feb 4, 2020 at 3:33 PM Christopher Hughes <[hidden email]> wrote:
Does anyone know if there's a way to configure a search service in geomoose 3 that searches
over multiple fields in a single box?

I'd like to be able to configure a simple search that allows users to enter information in a single box
and find results that match information in any of the fields you specify. This way they don't need to 
know as much about how your data is organized. My current workaround is to just create a new 
dataset that has all the fields I want, concatenated into a single field, and set geomoose to search 
that in the service. This gets the job done but I'd rather not modify the data if I don't have to.

Thanks,

Chris

--
Chris Hughes

GIS Analyst
Lincoln County Surveyor Department 
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283
_______________________________________________
Geomoose-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geomoose-users


--
Chris Hughes

GIS Analyst
Lincoln County Surveyor Department 
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283

_______________________________________________
Geomoose-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geomoose-users
Reply | Threaded
Open this post in threaded view
|

Re: [Geomoose-users] GeoMoose 3 - Search

chughes
Hi Dan,

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,
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
isn't defined. Do you have any ideas?

Working in the demo:
app.registerService('search', SearchService, {
 
    prepareFields: function(fields) {
        var query = ['or']; // adding or to the beginning should make it conditional.
       var queryFields = ['OWNER_NAME', 'OWN_ADD_L1', 'OWN_ADD_L3'];
        var searchValue = fields[0].value;
        for(var i = 0, ii = queryFields.length; i < ii; i++) {
                query.push({
                    comparitor: 'ilike',
                    name:queryFields[i],
                    value: '%' + searchValue + '%'
                });
        }
        return query;
    },
    fields: [
        {type: 'text', label: 'City/State/ZIP', name: 'prepareFields'}
    ],
    searchLayers: ['vector-parcels/parcels']


});


Thanks,
Chris









On Thu, Feb 6, 2020 at 3:07 PM Dan Little <[hidden email]> wrote:
Pass it in as an option on app.js. 

On Thu, Feb 6, 2020, 18:04 Christopher Hughes <[hidden email]> wrote:
Hi Dan,

Do you mean changing this in the search.js file or trying to overwrite this in app.js when creating the individual search service?

Thanks,

Chris

On Wed, Feb 5, 2020 at 6:42 AM Dan Little <[hidden email]> wrote:
Hi Chirs,

You can make that happen by overriding "prepareFields" in the options.

This is a little rough and untested but I believe this would do it:

prepareFields: function(fields) {
        var query = ['or']; // adding or to the beginning should make it conditional.
       var queryFields = ['PIN', 'NAME', 'STREETNAME'];
        var searchValue = fields[0].value;
        for(var i = 0, ii = queryFields.length; i < ii; i++) {
                query.push({
                    comparitor: 'ilike',
                    name:queryFields[i],
                    value: '%' + searchValue + '%'
                });
        }
        return query;
    };

On Tue, Feb 4, 2020 at 3:33 PM Christopher Hughes <[hidden email]> wrote:
Does anyone know if there's a way to configure a search service in geomoose 3 that searches
over multiple fields in a single box?

I'd like to be able to configure a simple search that allows users to enter information in a single box
and find results that match information in any of the fields you specify. This way they don't need to 
know as much about how your data is organized. My current workaround is to just create a new 
dataset that has all the fields I want, concatenated into a single field, and set geomoose to search 
that in the service. This gets the job done but I'd rather not modify the data if I don't have to.

Thanks,

Chris

--
Chris Hughes

GIS Analyst
Lincoln County Surveyor Department 
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283
_______________________________________________
Geomoose-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geomoose-users


--
Chris Hughes

GIS Analyst
Lincoln County Surveyor Department 
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283


--
Chris Hughes

GIS Analyst
Lincoln County Surveyor Department 
880 NE 7th St. l Newport, OR 97365
Tel: (541) 574 1283

_______________________________________________
Geomoose-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/geomoose-users