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

Weird search result (aka no result) - but the gem exists #1662

Closed
ghost opened this issue Jul 31, 2017 · 7 comments · Fixed by #2308
Closed

Weird search result (aka no result) - but the gem exists #1662

ghost opened this issue Jul 31, 2017 · 7 comments · Fixed by #2308

Comments

@ghost
Copy link

ghost commented Jul 31, 2017

Is this to be expected?

Search URL:

https://rubygems.org/search?utf8=%E2%9C%93&query=term-ans

That is, search for "term-ans".

No result turns up.

The gem I was looking for does exist though:

https://rubygems.org/gems/term-ansicolor

I would have assumed that a sub-string would match.

Is the above expected behaviour or is it a bug?

@ghost
Copy link
Author

ghost commented Aug 1, 2017

Interestingly, this query finds term-ansicolor using as query term-ansi:

https://rubygems.org/search?utf8=%E2%9C%93&query=term-ansi

Whereas if you chop off one character at the end, using as query term-ans:

https://rubygems.org/search?utf8=%E2%9C%93&query=term-ans

It says no gem is found. Can it be that there is some code that checks in an awkward manner based on the amount of input character or some possible query, which then may lead to some wrong result?

@TamerShlash
Copy link
Contributor

Looking at the source code, the search functionality uses ElasticSearch:

def self.search(query, es: false, page: 1)
return [nil, legacy_search(query).page(page)] unless es
result = elastic_search(query).page(page)
# Now we need to trigger the ES query so we can fallback if it fails
# rather than lazy loading from the view
result.response
[nil, result]
rescue Faraday::ConnectionFailed, Faraday::TimeoutError, Elasticsearch::Transport::Transport::Error => e
msg = error_msg query, e
[msg, legacy_search(query).page(page)]
end

So it's either a problem with the elastic search query constructed in elastic_search method, or in ElasticSearch itself.

@colby-swandale
Copy link
Member

Thanks for reporting this, yes this search should be listing the term-ansicolor gem in the results

@dwradcliffe
Copy link
Member

This is related to how elasticsearch indexes the gem names. There's a spectrum of too little to too much but I'm sure we can tweak it a bit.

@sghosh968
Copy link

@dwradcliffe : If nobody is working on this I would like to start working on this.

@sonalkr132
Copy link
Member

sure 👍 have at it.

@sghosh968
Copy link

Okay, thanks for the heads up @sonalkr132 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants