DEV Community

mahesh_attarde
mahesh_attarde

Posted on

Code Search and Navigation with livegrep

Using Code Search : Livegrep

After trying out bunch of indexing (tag) tools production/command-line, one that index git repo, uses ngram, has web frontend, includes docker setup. It is code search that just works!

(Original Github) [https://github.com/livegrep/livegrep]

This are instructions to run source indexer

  • Go to Source Directory
  • Clone repo and output index file with idx suffx current directory, mouted as data on container
docker run -v ${PWD}:/data ghcr.io/livegrep/livegrep/indexer /livegrep/bin/livegrep-github-reindex -repo doxygen/doxygen -http -dir /data
Enter fullscreen mode Exit fullscreen mode
  • Create Network
docker network create livegrep
Enter fullscreen mode Exit fullscreen mode
  • Create backend process load it with idx file and accept RPC call at grpc
docker run -d --rm -v ${PWD}:/data --network livegrep --name livegrep-backend ghcr.io/livegrep/livegrep/base /livegrep/bin/codesearch -load_index /data/livegrep.idx -grpc 0.0.0.0:9999
Enter fullscreen mode Exit fullscreen mode
  • Connect web app and backend process and publish web application
docker run -d --rm --network livegrep --publish 8910:8910 ghcr.io/livegrep/livegrep/base /livegrep/bin/livegrep -docroot /livegrep/web -listen 0.0.0.0:8910 --connect livegrep-backend:9999
Enter fullscreen mode Exit fullscreen mode
  • Using It

    1. Connect to "0.0.0.0:8910" of web application
    2. Search for Code literal
  • Best Parts

    1. LIVE GREPPING! Grep Works as you type. faster than egrep,grep
    2. Click on Search, it takes you to github file with anchor! :D

HTH!

Top comments (0)