GithubHelp home page GithubHelp logo

Search by Postcode about csv-importer HOT 10 CLOSED

pelias avatar pelias commented on June 2, 2024
Search by Postcode

from csv-importer.

Comments (10)

missinglink avatar missinglink commented on June 2, 2024 1

Try /v1/search?text=Arifa&categories=6022645523

from csv-importer.

missinglink avatar missinglink commented on June 2, 2024 1

Categories are unfortunately not well documented, you can use a comma to delimit multiple values, have a look at the geocoding.query.categories block in the response json to see how your input was interpreted.

is the category field indexed or it's returning time will be higher than general searches

It is indexed and should have a negligible impact on performance, likely it will be faster because it's excluding bunch of results it doesn't have to score

please keep in mind Pelias is not a relational database and it's not backed by one, so it's not like adding a column in SQL ;)

from csv-importer.

missinglink avatar missinglink commented on June 2, 2024

Hi @bdmapman, re "but in search, I am unable to search with the value", this seems to work for me:

You might be getting the parameters confused, the structured endpoint (/v1/search/structured) has a parameter named postalcode.
-https://github.com/pelias/documentation/blob/master/structured-geocoding.md#structured-geocoding-parameters
-https://github.com/pelias/documentation/blob/master/structured-geocoding.md#postalcode

There are a variety of filtering and scoring parameters on the fulltext endpoints /v1/search and /v1/autocomplete which you might be able to use, such as ?layers=postalcode but there is no parameter which allows you to specify the postcode separated from the rest of the ?text= param, this is what the /v1/search/structured endpoint is designed for.

see: https://github.com/pelias/documentation

Regarding /v1/reverse, what is the use-case for making a request when you already know the lat/lon and the postalcode? The reverse endpoint is designed to help you discover whats near a target lat/lon.

from csv-importer.

bdmapman avatar bdmapman commented on June 2, 2024

@missinglink Thanks for your prompt insight and Sorry for not giving the use-case properly. My data source is only CSV Importer. And I am using a long geocode (9-12 digits) as a postcode in my CSV. So that, besides names I can find any location by its geocodes. So the 12015 was only for example. Here is a sample file of my CSV structure. Is there any way to search based on Postalcode? I tried with a structured search. It is also not returning anything.
CleanShot 2021-08-02 at 16 31 45@2x
Do not worry about the source and layers. I have solved custom sources and layers manually.

from csv-importer.

missinglink avatar missinglink commented on June 2, 2024

Ugh so it seems like you're trying to use the postalcode field for something it's not intended for?
Each of the fields has semantic meaning which affects how the queries are generated.

I had a look at the code and the issue here is that the ?postcode=xxx param for /v1/search/structured is being ignored because you're not also supplying ?address=, this may or may not be ideal, I've opened an issue to discuss it with the team.

But regardless of that, the category field is a much better fit for what I think you're trying to do, its already set up to allow you to add arbitrary data and then filter on it.

Try changing the column name to category and then querying with ?categories=6022...., this should work for the /v1/search endpoint.

from csv-importer.

bdmapman avatar bdmapman commented on June 2, 2024

Unfortunately no luck. What I have done -

  • added a new category column in the CSV file
  • remove my full schema from elasticsearch and added a new blank schema called pelias
  • Imported the CSV file
  • Restarted the API service
  • search with /v1/search?categories=6022645523

But there is no luck. It is also returning

        "errors": [
            "invalid param 'text': text length, must be >0",
            "invalid param 'text': text length, must be >0"
        ],

Is the category field is newly launched? My Pelias is 1.5 years old. Do I need to add any config in the pelias.json file?

from csv-importer.

missinglink avatar missinglink commented on June 2, 2024

The ?text param is mandatory for /v1/search.

from csv-importer.

bdmapman avatar bdmapman commented on June 2, 2024

That's Great...That's Awesome!!!! Just out of curiosity I want to know, is the category field indexed or it's returning time will be higher than general searches? One more thing, If I want to include more than one category can I separate others with a comma? Is there any category documentation?

from csv-importer.

bdmapman avatar bdmapman commented on June 2, 2024

@missinglink I am really sorry for re-opening the issue. Just one thing I wanted to know is categories parameter usable in reverse geocoding API?

Another thing though I asked that in gitter. If I update source & layer data directly by using _update query of elasticsearch does that effect Pelias search API? After updating that specific entry vanished from my search API. Is it any kind of bug or restriction?

from csv-importer.

bdmapman avatar bdmapman commented on June 2, 2024

From this Discussion and this documentation I got to know that categories are currently available for search and autocomplete endpoints.

I am still searching for the second answer. I got some interesting findings probably know better than me. I am using the _update query of elasticsearch for a single entry

curl -X POST "localhost:9200/pelias/_update/custompoi:restaurant:45632?refresh=true&pretty=true" -H 'Content-Type: application/json' -d'
{
  "script" : "ctx._source.layer = \u0027shop\u0027"
}
'

It is changing the data. I can see the data using curl -X GET "localhost:9200/pelias/_doc/custompoi:restaurant:45632?pretty" through terminal. It's returning the changes of layer value to shop. In _gid field the value is still custompoi:restaurant:45632 whereas if I go through Postman and call the data using reverse or autocomplete API it is returning "gid": "custompoi:shop:45632",. It seems interesting that the _gid of elasticsearch and "gid" of API return are not the same. And yes, that specific entry is still missing from search API.

from csv-importer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.