Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exact alias match does not appear in search results #76

Closed
sttz opened this issue May 28, 2019 · 5 comments
Closed

Exact alias match does not appear in search results #76

sttz opened this issue May 28, 2019 · 5 comments
Labels
Bug Something isn't working In Progress We're working on it :)

Comments

@sttz
Copy link

sttz commented May 28, 2019

I'm trying to look up "KONOSUBA -God's blessing on this wonderful world!", which is the show's official title on Crunchyroll. This title exists as an alternative name on TMDB and it's returned by /shows/konosuba-god-s-blessing-on-this-wonderful-world/aliases.

But searching for this exact title does not return the show.

/search/show?query=KONOSUBA%20-God%27s%20blessing%20on%20this%20wonderful%20world! returns only different shows with low scores (< 2) and I couldn't find the show in the first couple of pages on the website's search.

What's going on? If I search for a title that has an exact match with an alias, shouldn't that show appear at the top of the results?

@rectifyer
Copy link
Contributor

We bump it to the top if the main title is an exact match. It should still move it higher if an alias is an exact match as well, but seems to not be. I am also wondering if the punctuation -! is preventing the match. Do you have another examples without punctuation? I'm curious if that returns the correct results or not.

@rectifyer rectifyer added Bug Something isn't working In Progress We're working on it :) labels Jul 22, 2019
@sttz
Copy link
Author

sttz commented Jul 23, 2019

It seems the -God is interfering with an exact match, maybe it's interpreted as an exclusion?

Removing the other punctation doesn't have an influence. Removing the dash or adding a space after it returns the correct match.

It seems quoting the title also works. This search returns the correct match.

Do you have more information on how the search works and which patterns it treats differently?

The way things are now, I'd probably have to do a quoted search first and then fall back to regular search and strip out any characters the have a special meaning in the query.

@rectifyer
Copy link
Contributor

rectifyer commented Oct 15, 2019

We use Solr for all searching and yeah it looks like - character is what is causing this issue. If the - is the middle of word I don't think it does this behavior, but since there is a space before it in -God it is treating it as an exclusion.

Prohibits the following term (that is, matches on fields or documents that do not include that term). The - operator is functionally similar to the Boolean operator !. Because it’s used by popular search engines such as Google, it may be more familiar to some user communities.

https://lucene.apache.org/solr/guide/6_6/the-standard-query-parser.html

@sttz
Copy link
Author

sttz commented Oct 21, 2019

Thanks for the details!

It seems I need to escape all the special characters:

Solr gives the following characters special meaning when they appear in a query:

+ - && || ! ( ) { } [ ] ^ " ~ * ? : /

To make Solr interpret any of these characters literally, rather as a special character, precede the character with a backslash character \.

It would be great if you could mention this in the API documentation, as it is quite useful to know what the query supports and what we need to watch out for.

@sttz sttz closed this as completed Oct 21, 2019
@rectifyer
Copy link
Contributor

Thanks for confirming and yes great idea to add this to the docs. I just updated that.

https://trakt.docs.apiary.io/#reference/search/text-query

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working In Progress We're working on it :)
Projects
None yet
Development

No branches or pull requests

2 participants