2022-07-19 14:26:16 +00:00
|
|
|
* Emacs Khoj
|
|
|
|
/An Emacs interface for [[https://github.com/debanjum/khoj][Khoj]]/
|
2021-08-16 08:27:46 +00:00
|
|
|
|
|
|
|
** Requirements
|
2022-07-19 14:26:16 +00:00
|
|
|
- Install and Run [[https://github.com/debanjum/khoj][Khoj]]
|
2021-08-16 08:27:46 +00:00
|
|
|
|
|
|
|
** Installation
|
|
|
|
- Direct Install
|
2022-07-19 14:26:16 +00:00
|
|
|
- Put ~khoj.el~ in your Emacs load path. For e.g ~/.emacs.d/lisp
|
2021-08-16 08:27:46 +00:00
|
|
|
|
|
|
|
- Load via ~use-package~ in your ~/.emacs.d/init.el or .emacs file by adding below snippet
|
|
|
|
#+begin_src elisp
|
2022-07-19 14:26:16 +00:00
|
|
|
;; Khoj Package
|
|
|
|
(use-package khoj
|
|
|
|
:load-path "~/.emacs.d/lisp/khoj.el"
|
|
|
|
:bind ("C-c s" . 'khoj))
|
2021-08-16 08:27:46 +00:00
|
|
|
#+end_src
|
|
|
|
|
2022-07-21 17:18:25 +00:00
|
|
|
- With [[https://github.com/raxod502/straight.el][straight.el]]
|
|
|
|
- Add below snippet to your ~/.emacs.d/init.el or .emacs config file and execute it.
|
|
|
|
#+begin_src elisp
|
|
|
|
;; Khoj Package for Semantic Search
|
|
|
|
(use-package khoj
|
|
|
|
:after org
|
|
|
|
:straight (khoj :type git :host github :repo "debanjum/khoj" :files (:defaults "src/interface/emacs/khoj.el"))
|
|
|
|
:bind ("C-c s" . 'khoj))
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
- With [[https://github.com/quelpa/quelpa#installation][Quelpa]]
|
2021-08-16 08:27:46 +00:00
|
|
|
- Ensure [[https://github.com/quelpa/quelpa#installation][Quelpa]], [[https://github.com/quelpa/quelpa-use-package#installation][quelpa-use-package]] are installed
|
|
|
|
- Add below snippet to your ~/.emacs.d/init.el or .emacs config file and execute it.
|
|
|
|
#+begin_src elisp
|
2022-07-19 14:26:16 +00:00
|
|
|
;; Khoj Package
|
|
|
|
(use-package khoj
|
2022-07-21 17:18:25 +00:00
|
|
|
:after org
|
2022-07-19 14:26:16 +00:00
|
|
|
:quelpa (khoj :fetcher url :url "https://raw.githubusercontent.com/debanjum/khoj/master/interface/emacs/khoj.el")
|
|
|
|
:bind ("C-c s" . 'khoj))
|
2021-08-16 08:27:46 +00:00
|
|
|
#+end_src
|
|
|
|
|
|
|
|
** Usage
|
2022-07-21 17:18:25 +00:00
|
|
|
1. Open Query Interface on Client
|
2021-08-16 08:27:46 +00:00
|
|
|
|
2022-07-21 17:18:25 +00:00
|
|
|
- In Emacs: Call ~khoj~ using keybinding ~C-c s~ or ~M-x khoj~
|
|
|
|
- On Web: Open http://localhost:8000/
|
2021-08-16 08:27:46 +00:00
|
|
|
|
2022-07-21 17:18:25 +00:00
|
|
|
2. Query in Natural Language
|
2021-08-16 08:27:46 +00:00
|
|
|
|
2022-07-21 17:18:25 +00:00
|
|
|
e.g "What is the meaning of life?" "What are my life goals?"
|
2021-08-16 08:27:46 +00:00
|
|
|
|
2022-07-21 17:18:25 +00:00
|
|
|
*Note: It takes about 4s on a Mac M1 and a >100K line corpus of notes*
|
2021-08-16 08:27:46 +00:00
|
|
|
|
2022-07-21 17:18:25 +00:00
|
|
|
3. (Optional) Narrow down results further
|
2021-08-16 08:27:46 +00:00
|
|
|
|
2022-07-21 17:18:25 +00:00
|
|
|
Include/Exclude specific words or date range from results by updating query with below query format
|
2021-08-16 08:27:46 +00:00
|
|
|
|
2022-07-21 17:18:25 +00:00
|
|
|
e.g `What is the meaning of life? -god +none dt:"last week"`
|