MicrosoftTCE / civic-graph-node

Civic Graph - Visualization Tool -
http://civicgraph.io
3 stars 0 forks source link

Both name and nickname appear in autocomplete for the same entity #30

Open sugaroverflow opened 9 years ago

sugaroverflow commented 9 years ago

John put my name in (as Fatima Sarah Khalid) during CodeAcross and added a nickname/abbreviation field (as Fatima Khalid) but I'm coming up twice in the autocomplete.

screen shot 2015-02-23 at 10 24 39 am

I tried this with other entities that have abbreviations/nicknames and the same thing happens.

screen shot 2015-02-23 at 10 28 48 am

screen shot 2015-02-23 at 10 28 24 am

I'm not sure if this is something that we want to have.

kenchandev commented 9 years ago

The reason I developed it in this manner is to give the user an option. For instance, maybe the user decides to type in "New York University" as opposed to "NYU." The user should be able to see this as a suggestion to validate his/her input. Both options will bring up the same node anyways.

luisdaniel commented 9 years ago

I had to do a similar autocomplete for OpenData500. I used a jquery autocomplete library. For this issue I have a look up json file where I keep name and a label. The label includes all the searchable items, so:

{
    "name":"New York University",
    "label": "New York University NYU"
}

jquery autocompletes looks through "label"'s but displays only "name". so if a user types "NYU", they'll see and select "New York University".

kenchandev commented 9 years ago

Interesting, I didn't realize jQuery had an autocomplete library. I could generate another .json file rather than having to create an associative array inside the codebase. Awesome suggestion!