unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Jean Louis <bugs@gnu.support>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: RE: Relevance search in Emacs
Date: Sat, 5 Dec 2020 13:43:12 -0800 (PST)	[thread overview]
Message-ID: <f8099ea7-05b4-4487-b8db-02b0d3405142@default> (raw)
In-Reply-To: <X8v69AAK+WaGhIAr@protected.rcdrun.com>

> > https://www.postgresql.org/docs/current/textsearch-intro.html*TEXTSEARCH-MATCHING
> >
> > That's apparently what's often called full-text search,
> > and which is an indexed search.  The text is indexed
> > ahead of time, and the index is used for search "lookup".
> 
> I am not using indexed method, just searching on the fly.

I see.  I figured it was full-text search because PostGres is
a database.

> Relevance search could be simpler in Emacs just for strings.

It can be anything you want it to be.

> > "Relevance" can mean anything.  Think of how much can go
> > into, say, a google search: "relevance" there can include
> > intimate detail about you as a person, your likes, etc.
> 
> What I mean is that words are closer to each other, for example
> that term: google intimate person
> find your above quoted paragraph.

IOW, nearness measures.  That's typically used with indexed
text.  No, AFAIK, vanilla Emacs has no such thing.  And it
doesn't have any relevance sorting, except possibly for
recency of use.

> > Yes, some Emacs 3rd-party libraries do provide "scoring"
> > of some kinds of searches.  For example, for certain kinds
> > of fuzzy matching a score can indicate how "closely" a
> > given candidate is matched by your search pattern.
> 
> Fuzzy matching could be good. Is there in Emacs similar? Not that I am
> looking for outside libraries.

Not in vanilla Emacs.  Well, I guess maybe they've recently
added some pseudo-fuzzy matching as a completion style.
But you can easily add your own as a completion style, for
any Emacs version.

3rd-party libraries have fuzzy matching.

Isearch+ gives you the ability to use nearness matching,
using dynamic filtering:

https://www.emacswiki.org/emacs/DynamicIsearchFiltering

From that page:

  Search for something that is near something else – within
  a given number of characters, words, lists, or sentences
  (you can add to this list of distance units, using option
  ‘isearchp-movement-unit-alist’). You specify the nearness.
  You can also constrain the nearby pattern to be only before
  or only after the search hit.

  Search for stuff in the union of given contexts. Example:
  search for text that is near ‘cat’ or near ‘dog’.

  Search for stuff outside contexts: Use the complement of
  any set of contexts as the search space. Example: search
  for text that is not near ‘cat’ and not near ‘dog’.

You can do anything you want, from just vanilla Emacs, as you
know.  You can also look to the code or design of 3rd-party
features for help or inspiration.  Free software means you
have the source.  You can, but you need not, reinvent your
own wheels.



  reply	other threads:[~2020-12-05 21:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-05 18:18 Relevance search in Emacs Jean Louis
2020-12-05 21:06 ` Drew Adams
2020-12-05 21:26   ` Jean Louis
2020-12-05 21:43     ` Drew Adams [this message]
2020-12-05 22:22 ` TRS-80
2020-12-06  4:59   ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f8099ea7-05b4-4487-b8db-02b0d3405142@default \
    --to=drew.adams@oracle.com \
    --cc=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).