[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Any package for boolean search?
From: |
Jean Louis |
Subject: |
Re: Any package for boolean search? |
Date: |
Thu, 26 Dec 2024 13:58:54 +0300 |
User-agent: |
Mutt/2.2.12 (2023-09-09) |
* Joel Reicher <joel.reicher@gmail.com> [2024-12-26 09:03]:
> Jean Louis <bugs@gnu.support> writes:
>
> > Boolean Search: This is a method where search terms are combined using
> > boolean logic, as described by the operators AND, OR, and NOT.
> >
> > I would like to implement this classic into the website search. And I
> > wish to keep it simple.
>
> Is there an Emacs or elisp aspect to this question I might be
> missing?
I don't know what you mean. I am looking for some ready package that
provides maybe string searching within other strings, by using boolean
operators.
I am starting the logic here below:
(defun wrs-search-query-process (query)
(let ((query (wrs-search-clean-query query)))
(cond
;; dispatch if there is no boolean
((not (string-match-p (rx word-start (or "OR" "NOT" "AND" word-end))
query))
(wrs-search-query query))
;; dispatch when there is AND but not OR or NOT
((and (string-match-p (rx word-start "AND" word-end) query)
(not (string-match-p (rx word-start (or "OR" "NOT" word-end))
query)))
(wrs-search-query-and query)))))
So there will be different ways how to process those parts of the
query separated by AND, OR, NOT and in various combinations.
> Are you after a package to submit a search to a particular search
> engine? Is that what you mean?
No.
It is website search, when user enters some terms to get list of
website pages. I don't have many, but 1300+ in single website has some
key information for people.
--
Jean Louis