Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDDIO-0000cl-Ey for pgsql-general@arkaria.postgresql.org; Sun, 07 Apr 2019 19:17:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hDDIN-0005tt-1p for pgsql-general@arkaria.postgresql.org; Sun, 07 Apr 2019 19:17:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDDIM-0005oq-9P for pgsql-general@lists.postgresql.org; Sun, 07 Apr 2019 19:17:34 +0000 Received: from ostrich.birch.relay.mailchannels.net ([23.83.209.138]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDDIJ-0006zH-Aq for pgsql-general@lists.postgresql.org; Sun, 07 Apr 2019 19:17:33 +0000 X-Sender-Id: dreamhost|x-authsender|jess.wren@interference.cc Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 21E653E3F69 for ; Sun, 7 Apr 2019 19:17:27 +0000 (UTC) Received: from pdx1-sub0-mail-a16.g.dreamhost.com (unknown [100.96.28.55]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id C87B33E4661 for ; Sun, 7 Apr 2019 19:17:26 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jess.wren@interference.cc Received: from pdx1-sub0-mail-a16.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.17.2); Sun, 07 Apr 2019 19:17:27 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jess.wren@interference.cc X-MailChannels-Auth-Id: dreamhost X-Shrill-Oafish: 75c0ca8b2b467042_1554664646920_3242285934 X-MC-Loop-Signature: 1554664646920:1004652790 X-MC-Ingress-Time: 1554664646920 Received: from pdx1-sub0-mail-a16.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a16.g.dreamhost.com (Postfix) with ESMTP id 667627FDCF for ; Sun, 7 Apr 2019 12:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=interference.cc; h=subject :to:references:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; s=interference.cc; bh=P UrqTCyvhphgqnrD8Be3zQzQwlc=; b=txYgRptMdf9Fw0xqPXiocAK+oXIYd3O/S oFIYZVrd92rg74jIwnsbLMjI27rdEs4q9HhbtWdQJwhHBpZy6UUHvPz9/0sT7VJZ 1cd5NcPqXEj24GQjYYHDmk6fIieLDLlsoP0aL46x8lXZtb0QWEj/F/jwN9V4f6qn UXyCnY7hoE= Received: from [10.0.0.112] (c-73-193-24-7.hsd1.wa.comcast.net [73.193.24.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jess.wren@interference.cc) by pdx1-sub0-mail-a16.g.dreamhost.com (Postfix) with ESMTPSA id E8A1C7FDCE for ; Sun, 7 Apr 2019 12:17:25 -0700 (PDT) Subject: Re: How to use full-text search URL parser to filter query results by domain name? To: pgsql-general@lists.postgresql.org References: X-DH-BACKEND: pdx1-sub0-mail-a16 From: Jess Wren Message-ID: Date: Sun, 7 Apr 2019 12:17:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 15 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduuddruddugddufeegucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdludehmdenucfjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeflvghsshcuhghrvghnuceojhgvshhsrdifrhgvnhesihhnthgvrhhfvghrvghntggvrdgttgeqnecukfhppeejfedrudelfedrvdegrdejnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopegluddtrddtrddtrdduuddvngdpihhnvghtpeejfedrudelfedrvdegrdejpdhrvghtuhhrnhdqphgrthhhpeflvghsshcuhghrvghnuceojhgvshhsrdifrhgvnhesihhnthgvrhhfvghrvghntggvrdgttgeqpdhmrghilhhfrhhomhepjhgvshhsrdifrhgvnhesihhnthgvrhhfvghrvghntggvrdgttgdpnhhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhgnecuvehluhhsthgvrhfuihiivgeptd List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/6/19 11:42 PM, hamann.w@t-online.de wrote: > Hi, > > I have no real idea about solving the complete problem, and would probably try > something with a temp table first. > For extracting the hostname from a url you could use > > select regex_replace('https?://(.*=)/.*', '\\1', url) > > instead of the fulltext parser > > Best regards > Wolfgang Thanks Wolfgang, I understand that I could implement a function using regex for this, or just create an extra column/table to store the hostname data. But there are other parts of the application where I'll need to extract URL path, others where i'll want to extract scheme, etc. Since postgres has builtin capabilities for parsing URLs to do alll of this, I'd rather just use the builtin functions instead of writing them myself using regex or having to generate a temp table each time I do a lookup. So although I'm aware that there are a variety of ways to extract hostname (right now I'm just doing it in Python), I'm really most interested in understanding how to use the builtin Postgres URL parsers to extract host, url path, etc and how to appropriately create indexes based on them. The documentation for the URL parser is very sparse, and I can't find much info online either.