duck7000 / imdbGraphQLPHP

5 stars 0 forks source link

Need for type in titleSearch class? #35

Closed duck7000 closed 3 months ago

duck7000 commented 7 months ago

@GeorgeFive @All Is there any need for this?

Personally i use all types (like it is now in titleSearch) but it can be extended to search by specific type like movie, game, podcast etc

I'm guessing not, nobody asked for it sofar

duck7000 commented 6 months ago

Nobody seems to need this, including me the author, so closing this one

duck7000 commented 4 months ago

re open this one as i consider to add it anyway

duck7000 commented 4 months ago

Added titleTypes to TitleSearch in latest commit all info is in doc bloc and wiki page

With this new parameter you can limit the search to specific titleTypes like MOVIE or MOVIE,TV (separate by comma if more then one)

@GeorgeFive this may help with your searches, possibly you don't have to higher the search amount if you select the type you are looking for?

GeorgeFive commented 4 months ago

Looks good! It didn't really help with the search amount though. I think the problem is that imdb searches based on popularity, not how close the titles actually match the search query. This is what I'm getting back for "The Circle".... the last one is the one I actually wanted:

The Circle (2017) - Connect Kingsman: The Golden Circle (2017) - Connect The Circle (2020) - Connect The Secret Circle (2011-2012) - Connect The Bletchley Circle (2012-2014) - Connect The Broken Circle Breakdown (2012) - Connect The Red Circle (1970) - Connect The Circle (2015) - Connect Squaring the Circle: The Story of Hipgnosis (2022) - Connect The Circle (2000) - Connect The Circle (2018-2021) - Connect Arctic Circle (2018) - Connect The Bletchley Circle: San Francisco (2018-2018) - Connect Lovers of the Arctic Circle (1998) - Connect Full Circle (2023-2023) - Connect The Circle (1957) - Connect Hercules: The Legendary Journeys - The Circle of Fire (1994) - Connect The Circle (2014) - Connect Circle (2015) - Connect The Circle (1925) - Connect The Inner Circle (1991) - Connect Mrs. Parker and the Vicious Circle (1994) - Connect The Inner Circle (2019-2019) - Connect The Circle (2005) - Connect

Not a huge deal, just an annoyance sometimes, and more than likely an issue with how they return data... not much we could do there.

GeorgeFive commented 4 months ago

You have the list of title types in the wiki... are there other types not listed? I ask, because after changing my code to search for "MOVIE,TV", I've noticed that adult titles no longer appear.

duck7000 commented 4 months ago

How the results are sorted is unknown as there are no sort options in graphQL API for mainSearch

for your search results i see 3 options left:

include the year in your searchTerm? Or i can add isExactmatch as query option parameter (this will get only titles that exactly matches the searchTerm? Or you can sort the results in your application?

duck7000 commented 4 months ago

You have the list of title types in the wiki... are there other types not listed? I ask, because after changing my code to search for "MOVIE,TV", I've noticed that adult titles no longer appear.

No this are the types that are listed to be working, why adult don't work i don't know

Does it work with a single type like MOVIE? Does it work if you don't provide a type?

Can you provide a searchTerm where this behavior occurs?

GeorgeFive commented 4 months ago

Searching for "MOVIE,TV" or just "MOVIE" with query "Pirates"... I'm expecting to find https://www.imdb.com/title/tt0477457/

Pirates of the Caribbean: The Curse of the Black Pearl (2003) - Connect Pirates of the Caribbean: Dead Men Tell No Tales (2017) - Connect Pirates of the Caribbean: On Stranger Tides (2011) - Connect Pirates of the Caribbean: Dead Man's Chest (2006) - Connect Pirates of the Caribbean: At World's End (2007) - Connect Pirates (1986) - Connect The Pirates (2014) - Connect The Pirates! Band of Misfits (2012) - Connect Pirates (2021) - Connect

Using no parameters... (last one is the expected result)

Pirates of the Caribbean: The Curse of the Black Pearl (2003) - Connect Pirates of the Caribbean: Dead Men Tell No Tales (2017) - Connect Pirates of the Caribbean: On Stranger Tides (2011) - Connect Pirates of the Caribbean: Dead Man's Chest (2006) - Connect Pirates of the Caribbean: At World's End (2007) - Connect Pirates (1986) - Connect Pirates (2005) - Connect

GeorgeFive commented 4 months ago

include the year in your searchTerm? Or i can add isExactmatch as query option parameter (this will get only titles that exactly matches the searchTerm?

Including year kinda works... it does indeed give the expected result as the first item, but the year has to be exactly right as it will only return items from the given year. So if you search for "Godzilla 1997", you're not going to get Godzilla from 1998 or any other year. In that case, I would like to see "Godzilla" from 1997 given more weight and ranked higher as I specified a year, but 1998 and other year versions should be returned as well.

isExactmatch could be an idea, but this goes back to the previous statement.... just like the name says, it would have to be exact ("Beekeeper" wouldn't find "The Beekeeper"). Maybe use isExactmatch to sort the array a little better, but not exclude items that don't exactly match? So this would change my above Circle example to...

The Circle (2017) - Connect The Circle (2020) - Connect The Circle (2015) - Connect The Circle (2000) - Connect The Circle (2018-2021) - Connect The Circle (1957) - Connect The Circle (2014) - Connect The Circle (1925) - Connect The Circle (2005) - Connect The Circle (2017) - Connect Kingsman: The Golden Circle (2017) - Connect The Secret Circle (2011-2012) - Connect The Bletchley Circle (2012-2014) - Connect The Broken Circle Breakdown (2012) - Connect The Red Circle (1970) - Connect Squaring the Circle: The Story of Hipgnosis (2022) - Connect Arctic Circle (2018) - Connect The Bletchley Circle: San Francisco (2018-2018) - Connect Lovers of the Arctic Circle (1998) - Connect Full Circle (2023-2023) - Connect Hercules: The Legendary Journeys - The Circle of Fire (1994) - Connect Circle (2015) - Connect The Inner Circle (1991) - Connect Mrs. Parker and the Vicious Circle (1994) - Connect The Inner Circle (2019-2019) - Connect

https://stackoverflow.com/questions/41240595/how-to-sort-array-by-matching-the-closest-to-input-string This could be a pretty slick way of doing it, but this could get complicated for the class.... I could implement it in my own code, if you don't want to place it in the overall class?

duck7000 commented 4 months ago

Mmm my thoughts

"pirates" as searchTerm is too common i guess? In this case you need to be more specific, for example with a year. But yes that would be a exact year likewise isExactMatch would do And Pirates 2005 that you want to be found is of type Video so using MOVIE or MOVIE,TV wouldn't work? searching without any types will find it as you showed above. I'll admit that this option might be handy but also might not so handy.. If you know that what you are looking for is of type movie or tv you can use that, otherwise leave it at null

I'll try to find the bug with no adult results (i think it is bug?) After a little thinking and trying i'm not convinced it is a bug as it seems to work

In GraphQL API there are no more options available for mainSearch so there is nothing more i can do, sorry IsExactMatch is the only one left to try

duck7000 commented 4 months ago

And the stackoverflow link is certainly interested but i think it is going far beyond the scope of this library so if you want to use that implant it in your app

GeorgeFive commented 4 months ago

Now that I dig deeper, yeah, I think it's the "VIDEO" type that is screwing things up, and I just happened to notice it on a couple of adult titles.

duck7000 commented 4 months ago

So it all works fine i presume?

GeorgeFive commented 4 months ago

I do believe so. They definitely need an option for VIDEO, but I realize that's out of our control here.

duck7000 commented 4 months ago

The problem is that within mainSearch there are less and different titleTypes then there are available in Title itself So you can only filter those few types, the point of using this filter is limit i guess

I will close it for now, if there is any change in the future we can discus it again. Thanks for testing though!

duck7000 commented 4 months ago

Imdb added a new option to the mainSearch method Search by year or year span is now supported so i'm thinking to implant that too

That would solve your issues above as you can provide a year span

I'm working on it (Done) Latest version contains this new option) @GeorgeFive

GeorgeFive commented 4 months ago

Looking good!

duck7000 commented 4 months ago

Thanks!