* Emacs Khoj
  [[https://stable.melpa.org/#/khoj][file:https://stable.melpa.org/packages/khoj-badge.svg]] [[https://melpa.org/#/khoj][file:https://melpa.org/packages/khoj-badge.svg]]
 
  /The Emacs interface for [[https://github.com/debanjum/khoj][Khoj]]/

** Prerequisites
   - Install and Run [[https://github.com/debanjum/khoj][Khoj]]

** Installation
**** Using MELPA
     #+begin_src elisp
      M-x package-install khoj
     #+end_src elisp

     Add below snippet to your Emacs config file
     #+begin_src elisp
     ;; Install Khoj Package from MELPA Stable
     (use-package khoj
        :ensure t
        :pin melpa-stable
        :bind ("C-c s" . 'khoj))
     #+end_src

    Note: Install ~khoj.el~ from MELPA (instead of MELPA Stable) if you installed the pre-release version of khoj
    - That is, use ~:pin melpa~ to install khoj.el in above snippet if khoj was installed with ~pip install --pre khoj-assistant~
    - Else use ~:pin melpa-stable~ to install khoj.el in above snippet if khoj was installed with ~pip install khoj-assistant~
    - This ensures both khoj.el and khoj app are from the same version (tagged or latest)

**** Using [[https://github.com/raxod502/straight.el][Straight.el]]
     Add below snippet to your Emacs config file
     #+begin_src elisp
       ;; Install Khoj Package using Straight.el
       (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

** Usage
   1. Open Query Interface on Client

       - In Emacs: Call ~khoj~ using keybinding ~C-c s~ or ~M-x khoj~
       - On Web: Open http://localhost:8000/

   2. Query Incrementally in Natural Language

      e.g "What is the meaning of life?" "What are my life goals?"

   3. Apply filters to narrow down results further

      Include/Exclude specific words or date range from results by updating query with below query format

      e.g `What is the meaning of life? -god +none dt:"last week"`

** Upgrade
Use your Emacs package manager to upgrade `khoj.el`

- For `khoj.el` from MELPA
  - Method 1
    - Run `M-x package-list-packages` to list all packages
    - Press `U` on `khoj` to mark it for upgrade
    - Press `x` to execute the marked actions
  - Method 2
    - Run `M-x package-refresh-content`
    - Run `M-x package-reinstall khoj`

- For `khoj.el` from Straight
  - Run `M-x straight-pull-package khoj`
