From: Artjom Simon <artjom.simon@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Replacing Apache Solr with Postgre Full Text Search?
Date: Thu, 26 Mar 2020 19:19:42 +0100
Message-ID: <9d736364-0156-0a4d-d00f-bd5e8520ebb0@gmail.com> (raw)
In-Reply-To: <CAK-aFFbTWVncsfQKP1YUffNdPpB1OjEJFsSAuFng7KnMnx3mPA@mail.gmail.com>
References: <CAK-aFFb=Xur5e9y758G1Qh_h8+7b+kME=Wd3vREkbEL3HcB=-g@mail.gmail.com>
<CAO8ar=nBCqt+aTrSrNNvqp5FbKzX+kJiZe1jtDWgga=TDau7Ag@mail.gmail.com>
<CAK-aFFbaE33n4t_wOdHGwAZYPacpo-v87w72tA5cZcdAdRCYkw@mail.gmail.com>
<CAO8ar==10fY-Q+mP+krz+eMdqcQ1CtSdtHzPiC0NGj5WafWzUQ@mail.gmail.com>
<CAK-aFFbTWVncsfQKP1YUffNdPpB1OjEJFsSAuFng7KnMnx3mPA@mail.gmail.com>
On 26.03.20 17:05, J2eeInside J2eeInside wrote:
>> P.S. I need to index .pdf, .html and MS Word .doc/.docx files, is
>> there any constraints in Ful Text search regarding those file types?
>
> - Can you recommend those tools you mention above/any useful resource
on how to do that?
For PDFs, I know of at least two tools that can extract text. Try
Ghostscript:
gs -sDEVICE=txtwrite -o output.txt input.pdf
or a tool called 'pdftotext':
pdftotext [options] [PDF-file [text-file]]
Both give slightly different results, mainly in terms of indentation and
layout of the generated plain text, and how they deal with tabular layouts.
Note that PDF is a container format that can embed virtually anything:
text, images, flash videos, ...
You'll get good results if the PDF input is plain text. If you're
dealing with embedded images like scanned documents, you'll probably
need a OCR pass with tools like 'tesseract' to extract the recognized text.
You'll need similar tools to extract the text from DOC and HTML files
since you're only interested in their plain text representation, not the
meta data and markup.
Finding converters from HTML/DOC to plain text shouldn't be too hard.
You could also try to find a commercial document conversion vendor, or
try to convert HTML and DOC both to PDF so you'll only have to deal with
PDF-to-text extraction in the end.
Good luck!
Artjom
--
Artjom Simon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: artjom.simon@gmail.com
Subject: Re: Replacing Apache Solr with Postgre Full Text Search?
In-Reply-To: <9d736364-0156-0a4d-d00f-bd5e8520ebb0@gmail.com>
References: <CAK-aFFb=Xur5e9y758G1Qh_h8+7b+kME=Wd3vREkbEL3HcB=-g@mail.gmail.com> <CAO8ar=nBCqt+aTrSrNNvqp5FbKzX+kJiZe1jtDWgga=TDau7Ag@mail.gmail.com> <CAK-aFFbaE33n4t_wOdHGwAZYPacpo-v87w72tA5cZcdAdRCYkw@mail.gmail.com> <CAO8ar==10fY-Q+mP+krz+eMdqcQ1CtSdtHzPiC0NGj5WafWzUQ@mail.gmail.com> <CAK-aFFbTWVncsfQKP1YUffNdPpB1OjEJFsSAuFng7KnMnx3mPA@mail.gmail.com> <9d736364-0156-0a4d-d00f-bd5e8520ebb0@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox