-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Add "search as you type" functionality #504
Comments
On the section index:
|
I would like to give it a try. |
Great -- we're using elastic search as the backend, which can be setup locally as documented here: http://docs.readthedocs.io/en/latest/rtfd.html#elastic-search-setup The main search views are here: https://github.com/rtfd/readthedocs.org/blob/master/readthedocs/search/views.py I'm not 100% sure how to implement this on the ES side, so that would take some research. |
Really excited to see its coming next to my work. |
@robhudson Thanks a lot for filling the issue. I will work on this in next couple of weeks. |
I'd really like to see us be able to index & autocomplete API objects as well. So that you could type This existing Sphinx extension has at least a basic take on this: https://github.com/jimfulton/sphinxautoindex/tree/master/findanything -- but could definitely use some UX improvements :) |
I have investigated about it and found that we need some UX decision about it.
We have search page where we can implement easily Search as you Type functionality easily. But we need to decide if we want that feature also in the sidebar. Moreover, we need to learn about |
This sounds to not scale in a good way and probably something that we can't support in the community site with thousands of projects.
The example you showed here it's amazing to me and I'd like to follow that direction! These are just opinions, though, I'm not really involved in the search world inside Read the Docs. |
I did some research on how algolia implemented its search on Requests docs... When query is POST data sent with each request - {
"requests": [
{
"indexName": "python-requests",
"params": "query=This%20part%20of%20documentation&hitsPerPage=5"
}
]
} GET data sent with each request - x-algolia-agent: Algolia%20for%20vanilla%20JavaScript%20(lite)%203.30.0%3Bdocsearch.js%202.6.2
x-algolia-application-id: BH4xxxxxx
x-algolia-api-key: f177061e2354c50a97bfxxxxxxxxxxxx Result (in json) - Full response - here {
"results":[
{
"hits":[
{
"hierarchy":{
"lvl2":null,
"lvl3":null,
"lvl0":"Installation of Requests",
"lvl1":null,
"lvl6":null,
"lvl4":null,
"lvl5":null
},
"url":"https://2.python-requests.org/en/master/user/install/#install",
"content":"This part of the documentation covers the installation of Requests.\nThe first step to using any software package is getting it properly installed.",
"anchor":"install",
"objectID":"3180085671",
"_snippetResult":{
"content":{
"value":"<span class=\"algolia-docsearch-suggestion--highlight\">This</span> <span class=\"algolia-docsearch-suggestion--highlight\">part</span> <span class=\"algolia-docsearch-suggestion--highlight\">of</span> the <span class=\"algolia-docsearch-suggestion--highlight\">documentation</span> covers the installation <span class=\"algolia-docsearch-suggestion--highlight\">of</span> Requests",
"matchLevel":"full"
}
},
"_highlightResult":{
"hierarchy":{
"lvl0":{
"value":"Installation <span class=\"algolia-docsearch-suggestion--highlight\">of</span> Requests",
"matchLevel":"partial",
"fullyHighlighted":false,
"matchedWords":[
"of"
]
}
},
"content":{
"value":"<span class=\"algolia-docsearch-suggestion--highlight\">This</span> <span class=\"algolia-docsearch-suggestion--highlight\">part</span> <span class=\"algolia-docsearch-suggestion--highlight\">of</span> the <span class=\"algolia-docsearch-suggestion--highlight\">documentation</span> covers the installation <span class=\"algolia-docsearch-suggestion--highlight\">of</span> Requests.\nThe first step to using any software package is getting it properly installed.",
"matchLevel":"full",
"fullyHighlighted":false,
"matchedWords":[
"this",
"part",
"of",
"documentation"
]
},
"hierarchy_camel":[
{
"lvl0":{
"value":"Installation <span class=\"algolia-docsearch-suggestion--highlight\">of</span> Requests",
"matchLevel":"partial",
"fullyHighlighted":false,
"matchedWords":[
"of"
]
}
}
]
}
},
{..},
{..},
{..},
{..}
],
"nbHits":7,
"page":0,
"nbPages":2,
"hitsPerPage":5,
"processingTimeMS":1,
"exhaustiveNbHits":true,
"query":"This part of documentation",
"params":"query=This%20part%20of%20documentation&hitsPerPage=5",
"index":"python-requests"
}
]
} Observations -
Conclusion - For the UI part, I believe that sending the data pre-formatted with proper html tags is something we should do as it will reduce the load on client side. Also, I searched for a JS library which we can use but it was of no use. The UI shown in the above image is nice, but we want to have our own and better than this. For the backend part, I believe that we should create a single API endpoint with parameters so that it can be used for all the projects.
I am not sure that whether this will be a advantage/disadvantage for us. And also for the Completion Suggester, we need to have some changes in our doc-types of the Starting the work - My suggestion is to start the backend work after some design decisions. And simultaneously start working on the frontend (after deciding on the UI). Frontend work can be started on Codepen.io. Blog - Also, I will be maintaining a blog for the GSoC period. Are there any suggestions for the name? I am thinking something like this - gsoc19-with-rtd.wordpress.com ?? |
Hi all |
Relevant Elasticsearch docs:
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-suggesters-completion.html
For project search we can autocomplete project name or slug.
For page search within a project we can autocomplete page titles and possibly headers? This may or may not be as useful as project autocompletion.
The text was updated successfully, but these errors were encountered: