Use khoj-incremental as the main khoj func. Rename khoj to khoj-simple

- Update khoj-simple to work cross-encoder re-ranked results like before
- Increment major version as incremental search considered a breaking
  change and a major update to search capability
This commit is contained in:
Debanjum Singh Solanky
2022-07-27 18:18:17 +04:00
parent 09727ac3be
commit 9302b45fe0

View File

@@ -1,9 +1,9 @@
;;; khoj.el --- Natural Search via Emacs
;;; khoj.el --- Natural, Incremental Search via Emacs
;; Copyright (C) 2021-2022 Debanjum Singh Solanky
;; Author: Debanjum Singh Solanky <debanjum@gmail.com>
;; Version: 1.0
;; Version: 2.0
;; Keywords: search, org-mode, outlines, markdown, image
;; URL: http://github.com/debanjum/khoj/interface/emacs
@@ -26,10 +26,10 @@
;;; Commentary:
;; This package provides natural language search on org-mode notes,
;; markdown files, beancount transactions and images.
;; This package provides a natural, incremental search interface to your
;; org-mode notes, markdown files, beancount transactions and images.
;; It is a wrapper that interfaces with transformer based ML models.
;; The models search capabilities are exposed via the Khoj HTTP API
;; The models search capabilities are exposed via the Khoj HTTP API.
;;; Code:
@@ -184,7 +184,7 @@
(remove-hook 'minibuffer-exit-hook #'khoj--remove-incremental-query))
;;;###autoload
(defun khoj-incremental ()
(defun khoj ()
"Natural, Incremental Search for your personal notes, transactions and music using Khoj"
(interactive)
(let* ((default-type (khoj--buffer-name-to-search-type (buffer-name)))
@@ -200,12 +200,13 @@
(read-string khoj--query-prompt))))
;;;###autoload
(defun khoj (query)
"Search your content naturally using the Khoj API"
(defun khoj-simple (query)
"Natural Search for your personal notes, transactions, music and images using Khoj"
(interactive "sQuery: ")
(let* ((default-type (khoj--buffer-name-to-search-type (buffer-name)))
(let* ((rerank "true")
(default-type (khoj--buffer-name-to-search-type (buffer-name)))
(search-type (completing-read "Type: " '("org" "markdown" "ledger" "music" "image") nil t default-type))
(query-url (khoj--construct-api-query query search-type))
(query-url (khoj--construct-api-query query search-type rerank))
(buffer-name (get-buffer-create (format "*Khoj (q:%s t:%s)*" query search-type))))
(khoj--query-api-and-render-results
query