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

Add a route that can be searched directly with parameters #428

Closed
theowenyoung opened this issue Jul 11, 2022 · 5 comments · Fixed by #430
Closed

Add a route that can be searched directly with parameters #428

theowenyoung opened this issue Jul 11, 2022 · 5 comments · Fixed by #430
Assignees

Comments

@theowenyoung
Copy link

Hi, this is an amazing project, I want to use it as my blog's global search, is it a use case?

Now I can manually enter https://github1s.com/theowenyoung/blog, and click the search button to search the files, but it's really helped if there is a direct route to navigate the search panel. something like:

https://github1s.com/theowenyoung/blog/panel/search?q=term&files-include=content

does it possible? or if can, I can try to submit a pr.

@welcome
Copy link

welcome bot commented Jul 11, 2022

Hello there!👋 Welcome to the project!💖 Thank you and congrats🎉for opening your very first issue in this project.Be patient while we get back to you.😄

@github-actions
Copy link

Hello there theowenyoung 👋

Welcome to github1s !!💖🥳

Thank you and congratulations 🎉 for opening your very first issue in this project. github1s fosters an open and welcoming environment for all our contributors.🌸

Incase you want to claim this issue, please comment down below! We will try to get back to you as soon as we can.👀

Feel free to visit github1s.com. 👩‍💻 If you have any interesting ideas, just open an issue. We would love to hear you and engage in discussions.

@Siddhant-K-code
Copy link
Collaborator

For Search, we use Sourcegraph GraphQL APIs. Which hits the endpoint: https://sourcegraph.com/.api/graphql with payload:

{
  "variables": {
    "query": "repo:^github\\.com/theowenyoung/blog$ file:content -file:\\.git|\\.svn|\\.hg|CVS|\\.DS_Store|Thumbs.db|\\.crswap|node_modules|bower_components|\\.code-search \"term\" count:30"
  },
  "query": "query ($query: String!) {\n  search(query: $query) {\n    results {\n      __typename\n      limitHit\n      matchCount\n      approximateResultCount\n      missing {\n        name\n        __typename\n      }\n      cloning {\n        name\n        __typename\n      }\n      timedout {\n        name\n        __typename\n      }\n      indexUnavailable\n      results {\n        ... on FileMatch {\n          __typename\n          file {\n            name\n            path\n            __typename\n          }\n          lineMatches {\n            preview\n            lineNumber\n            offsetAndLengths\n            __typename\n          }\n        }\n        __typename\n      }\n    }\n    __typename\n  }\n}"
}

I am not 100% sure that is possible. But there should be some workaround for that.

WDYT? @conwnet @xcv58

@xcv58
Copy link
Collaborator

xcv58 commented Jul 13, 2022

I think it's doable but we need to refactor the code to sync the search state with URL.

@conwnet conwnet self-assigned this Jul 13, 2022
@conwnet
Copy link
Owner

conwnet commented Jul 13, 2022

yes, and I think this is reasonable, let me support it at next version

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

Successfully merging a pull request may close this issue.

4 participants