Try 30 days of free premium.

Different results when doing search with hyphen or space between the words

carpintero wrote 7 years ago: 1

Hi,
I used the API to search for info on "The Crown"

http://api.tvmaze.com/search/shows?q="the-crown"

when I did the same on /singlesearch/ I only got the info on show id 3551
Then I did a search with
http://api.tvmaze.com/search/shows?q="the crown"

Interestingly the info for show id 3551 is not part of the result.
Somehow a search with "-" instead of " " in the search phrase is producing different results.

So my question is: Do I use the /search/ or /singlesearch/ API with a "-" or with a " " in the search phrase ?
I had misses and matches with both so I am just wondering what the general advice is.

Thanks


gazza911 wrote 7 years ago: 1

I would suggest to always use a space as opposed to a hyphen;

The reason being is that if there's a show that has a hyphen in it, for example Hawaii Five-0, it will have the same score (relevance to query) using a hyphen and without it:

http://api.tvmaze.com/search/shows?q=Hawaii%20Five-0

http://api.tvmaze.com/search/shows?q=Hawaii%20Five%200

And another example, X-Rated: With hyphen, without - same score of 2.3432531.

Therefore as there's no score difference when there is a hyphen, it's better to ensure that other searches such as the one you listed above are as accurate as possible.

P.S Searching for "the crown" (without hyphen) shows both The Crown and The Jewel in the Crown - it's not listed at the top as The Crown is more relevant to the query (considering all the words are matched) with a score of 3.4170766 against 1.3630807 for The Jewel in the Crown.

Yes, the one with the hypen probably should still show The Crown, albeit with a lower relevance (as it doesn't match exactly) however until that's the case, I'd just replace hyphens with spaces.

carpintero wrote 7 years ago: 1

Tthank you for the quick answer, I will do that :)
The reason I started using the hyphen in the first place was because the URL listed all the shows with a hyphen ...

Anyway.
Thanks again!


gazza911 wrote 7 years ago: 1

carpintero wrote:
Tthank you for the quick answer, I will do that :)
The reason I started using the hyphen in the first place was because the URL listed all the shows with a hyphen ...
Anyway.
Thanks again!

I think that's just to make it easier to read rather than having %20 every time there's a space; the%20crown vs the-crown

Try 30 days of free premium.