aws Cloud search - short query - amazon-cloudsearch

In my cloud search document I have list of persons I want to search in. Now, let's say there are a people with name David, Dan and Dennis. Everything works alright when I query full name (for example: David) - I get back all the persons with the name David. But what if I want to return all persons who's name starts with Da (so cloud search will leturn David, Dan and Dennis)? Is it possible to achieve this behaviour?
For context: I am building an application where user can search people by name (and some other attributes) and I don't want the user to have to type the full name of person to find...

Oh I found it. I need to use text prefiex:
https://docs.aws.amazon.com/cloudsearch/latest/developerguide/searching-text.html#searching-text-prefixes

Related

SPARQL - Query any information of things in DBpedia

I would like to find description of specific things without knowing whether the things are Thing, Person, Place, Location, etc.
I wonder If I am able to do so in DBpedia?
Eg:
Search: Manchester United.
Query Result: Manchester United Football Club, commonly known as Man. And so on....
Search: Maldives.
Query Result: The Maldives is a tropical nation in the Indian Ocean composed of 26 ring-shaped atolls. And so on....
I suggest you check out the Faceted Browser, a feature of Virtuoso, which powers the public DBpedia endpoints.
Search on "Manchester United".
Have an idea what type the entity you're looking for is? Click "Type" in the right-hand link list.
Explore as you will... Eventually you'll find a page that seems useful.
a. Want to save that page for later? Click "Permalink" and copy the full link from the address box -- or just right-click "Permalink" and choose "copy link" from the contextual menu -- or bookmark the "Permalink".
b. Want to edit that query to build your own? Try "View query as SPARQL".

Selecting more than one value

Trying to generate a list of tracks composed by more than one person.
Name Composer Make
So it should look something like this
Name composer Make
Going home Robert dennings / Don Bedge Robert dennings , Don Bedge
You probably want something like this
SELECT Name, Composer, REPLACE(Composer,'/',',') AS Make
FROM tracks
But it really is impossible to tell for sure given that you don't tell us any of the table or field names in your database and very little about your database model

Using LIKE in SQL Server to identify strings

I am writing a program that performs operations on a database of Football matches and data. One of the issues that I have is that my source data does not have consistent naming of each Team. So Leyton Orient could appear as L Orient. Most of the time this team is listed as L Orient. So I need to find the closest match to a team name when it does not appear in the database team name list exactly as it appears in the data that I am importing. Currently in my database I have a table 'Team' with a data sample as follows:
TeamID TeamName TeamLocation
1 Arsenal England
2 Aston Villa England
3 L Orient England
If the name 'Leyton Orient' appears in the data being imported I need to match this to L Orient and get the TeamID 3. My question is, can I use the LIKE function to achieve this in a case where the team name is longer than the name in the database?
I have figured out that if I had 'Leyton Orient' in the table and was importing 'L Orient' I could locate the correct entry with:
SELECT TeamName FROM Team WHERE TeamName LIKE '%l%orient%';
But can I do it the other way around? Also, I could have an example like Manchester United and I want to import Man Utd. I could find this by putting a % sign between every character like this:
SELECT TeamName FROM Team WHERE TeamName LIKE '%M%a%n%U%t%d%';
But is there a better way?
Finally, and this might be better put in another question, I would like not to have to search for the correct team when the way a team is named is repeated, i.e. I would like to store alternative spellings/aliases for teams in order to find the correct team entry quickly. Can anybody advise on how I might approach this? Thanks
The solution you are looking for is the FULL TEXT SEARCH, it'll require your DBA to create a full text index, however, once there you can perform much more powerful searches than just character pattern matching.
As the others have suggested, you could also just have an Alias table, which contains all possible forms of a team name and reference that. depending on how your search is working, that may well be the path of least resistance.
Finally, and this might be better put in another question, I would like not to have to search for the correct team when the way a team is named is repeated, i.e. I would like to store alternative spellings/aliases for teams in order to find the correct team entry quickly. Can anybody advise on how I might approach this? Thank
I would personally have a team table and a teamalias table. Use relationships to marry them up.
I believe the best way to prevent this, is to have a list of teams names displayed in a dropdown list. This will also let you drop validation for the team name. The users can now only choose one set team name and will also make it much easier for you working in your database. then you can look for the exact team name as it appears in your database. i.e.:
SELECT TeamName FROM Team WHERE TeamName = [dropdownlist_name];

Album search API return different results

I've got a different result when requesting the Deezer search API for an album from my production server:
for instance this search: http://api.deezer.com/search/album?q=Billy%20Ze%20kick%20et%20Les%20Gamins%20en%20Folie%20Billy%20Ze%20Kick%20et%20Les%20Gamins%20en%20Folie
-on my laptop in France, I've got 2 results and the album #215350 as first result
-on an heroku europe instance I've got 2 results, and the album #41910 as first result (absolutely no result if the heroku instance is in the US...)
-and on my production (digital ocean in Amsterdam) server I've got the album #41910 as one and only result.
I'm assuming there is a legal issue related on which country this album is available but is there any way to avoid this?
others similars APIs have a local attribute which allow me to see if the album is available in the country of my end user...
this is a real issue my server is in Amsterdam... my users are everywhere...
Any idea or solution?
Thanks!
Search results are localized based on the current user's country (IP based). You can override the country by passing a user token to the request to make sure you always get the same results.
About availability, it is track-based: if you want to know if the song is available in a country, you'll have to query each track from your album. For example, http://api.deezer.com/track/2150054 returns the list of available countries.

Query User by City using the Soundcloud Web API

Is it possible to fetch users by city or country? I would like to create something very local!
I've checked the available documentation but fail to see any solution to this, so this is a final stretch.
The City and Country properties are not searchable with the provided q parameter in the API, and as this searches over username / description and title you'd return a large number of false positives if it could.
It's unlikely you could over select as mentioned in the comments, as there are just too many users to pull down and then parse.