Use index with x = ANY(array_column) expression

2018-06-08 Thread Havasvölgyi Ottó
Hi all,

Is there a way to speed up ANY-based array element search with some kind of
index?
I mean this:

WHERE  = ANY()

Or is GIN index the only option with the @> operator?

WHERE  @> ARRAY[]

Thank you,
Otto


Re: [GENERAL] Full text search with plain input

2018-05-04 Thread Havasvölgyi Ottó
Thank you David, I will do something similar.

2018-05-05 3:12 GMT+02:00 David G. Johnston <david.g.johns...@gmail.com>:

> On Friday, May 4, 2018, Havasvölgyi Ottó <havasvolgyi.o...@gmail.com>
> wrote:
>
>>
>> Now I am thinking about splitting the input text myself to terms, then
>> searching and ranking  the documents for each term.
>>
>
> Maybe do: replace(input_text, ' ', ' | ')
>
> David J.
>


Re: [GENERAL] Full text search with plain input

2018-05-04 Thread Havasvölgyi Ottó
Based on the docs, plainto_tsquery() creates tsquery with the & operator (
https://www.postgresql.org/docs/10/static/functions-textsearch.html), so
the @@ operator will not find partial matches. And this way I cannot
calculate ts_rank for those partial matches.
Now I am thinking about splitting the input text myself to terms, then
searching and ranking  the documents for each term. Finally summing the
scores by document. This way the documents with more matching terms would
get greater score.
Please anybody let me know if there is some better/easier solution for this.

Thanks,
Otto


2018-05-05 2:06 GMT+02:00 David G. Johnston <david.g.johns...@gmail.com>:

> On Friday, May 4, 2018, Havasvölgyi Ottó <havasvolgyi.o...@gmail.com>
> wrote:
>
>>  so that it matches (with less rank) even if one of its words match ?
>>
>
> That seems to be what "ts_rank" provides.
>
> David J.
>
>


[GENERAL] Full text search with plain input

2018-05-04 Thread Havasvölgyi Ottó
Hi,

I would like to use PostgreSQL's FTS functionality.
The user would enter a search text, one or more words.
There is a suitable plainto_tsquery()  function, but it's to strict. It
only matches if all words match. What is the best practice to make this
kind of search more "forgiving", so that it matches (with less rank) even
if one of its words match ?

Thanks,
Otto