Re: [GENERAL] jsonb

2017-11-14 Thread hmidi slim
I'm trying to use the function to_jsonb and create the name:
to_jsonb ('{"key1":" ' || 'text1' || '","key2":" ' || 'text2' || '"}');
But after that I used Objection.js ORM to get data using the query:
Product.query().where('id',1).then(prod => {console.log(prod)})
I think that the problem maybe with the usage of to_jsonb function, maybe I
miss something. But when I fetch the data with the ORM I found that the
type was a string and not a jsonb


2017-11-14 23:09 GMT+01:00 Merlin Moncure :

> On Tue, Nov 14, 2017 at 3:32 PM, hmidi slim  wrote:
> > I have a column name of type 'jsonb' on my table named product. The
> format
> > of the column:
> > name: {"key1": "text1", "key2": "text2"}
> >
> > When I make a query to fetch data from the table I got this format:
> > name: '{"key1": "text1", "key2": "text2"}'
> >
> > Why does postgresql returns the name such as string type and not jsonb?
> is
> > it a bug or is there something else to add?
>
> not quite following.  Can you paste the query you are trying to
> execute along with the results vs. expectation?  thanks
>
> merlin
>


[GENERAL] jsonb

2017-11-14 Thread hmidi slim
I have a column name of type 'jsonb' on my table named product. The format
of the column:
name: {"key1": "text1", "key2": "text2"}

When I make a query to fetch data from the table I got this format:
name: '{"key1": "text1", "key2": "text2"}'

Why does postgresql returns the name such as string type and not jsonb? is
it a bug or is there something else to add?


Re: [GENERAL] Spelling dictionaries

2017-11-10 Thread hmidi slim
What about pg_similarity https://github.com/eulerto/pg_similarity. Do you
have any idea about this?

2017-11-10 10:36 GMT+01:00 Arthur Zakirov :

> On Fri, Nov 10, 2017 at 10:16:06AM +0100, hmidi slim wrote:
> > Hi,
> > I'm using Full Text search and I'm interested on using spelling
> dictionary.
> > I found a website that has a special functionality, for example when I
> > enter the word 'activities' it gives me the suggestions containing this
> > word. But when I enter the word 'activityns' it returns 'No result for
> > 'activityns'' But it gives me some suggestions contained the word
> > 'activities'.
> > In cas I entered the word 'activityng' it returns the same message 'No
> > result for 'activityng' ' But I got some suggestions containing the word
> > 'activity'.
> > Does this the behaviour of the lspell dictionary, because I didn't
> > understand how does he give suggestions when the word is wrong.
>
> You can try pg_trgm extension [1].
>
> Also we have a little demo web-site [2]. It uses pg_trgm. You can look at
> its code [3].
>
>
> 1 - https://www.postgresql.org/docs/current/static/pgtrgm.
> html#idm4642863576
> 2 - http://tsdemo.postgrespro.ru/search?pattern=Galaksy&order=
> rank&rank_func=ts_rank
> 3 - https://github.com/postgrespro/apod_fts/blob/master/apod.py
>
> --
> Arthur Zakirov
> Postgres Professional: http://www.postgrespro.com
> Russian Postgres Company
>


[GENERAL] Spelling dictionaries

2017-11-10 Thread hmidi slim
Hi,
I'm using Full Text search and I'm interested on using spelling dictionary.
I found a website that has a special functionality, for example when I
enter the word 'activities' it gives me the suggestions containing this
word. But when I enter the word 'activityns' it returns 'No result for
'activityns'' But it gives me some suggestions contained the word
'activities'.
In cas I entered the word 'activityng' it returns the same message 'No
result for 'activityng' ' But I got some suggestions containing the word
'activity'.
Does this the behaviour of the lspell dictionary, because I didn't
understand how does he give suggestions when the word is wrong.


Re: [GENERAL] Combine multiple text search configuration

2017-11-06 Thread hmidi slim
Hi,
Thank for your proposition but when to use this query :
(to_tsvector('english', document) || to_tsvector('french', document)) @@
(to_tsquery('english', query) || to_tsquery('french', query))
I think that the performance decrease and not a good solution for big
amount of data. Is it?


2017-11-06 20:46 GMT+01:00 Johannes Graƫn :

> Hi,
>
>
> On 2017-11-06 09:17, hmidi slim wrote:
> > Hi,
> > I want to know if I can combine multiple text search configurations when
> > I tried to use FTS.
> > Is there any options like this:
> > *to_tsvector(['english', 'french'], document)*
> > *
> > *
> > Trying to create a new text configuration:
> > *Create text search configuration test (copy=simple)*
> > *Alter text search configuration test*
> > *add mapping for asciiword with english_stem,french_stem*
> > *
> > *
> > This query doesn't work. How can I combine multiple text search
> > configurations if I need more than one into my query to search a word?
>
> what about using two indexes, one for each language? If your documents
> can either be English OR French, the English OR the French vector should
> match an English OR French tsquery.
>
> It is not clear to me how combining two stemmers should practically work
> since each word can only have one stem. If you have multilingual
> documents or texts with code switching, you could also try combining the
> two vectors both for the documents and the query:
>
> (to_tsvector('english', document) || to_tsvector('french', document)) @@
> (to_tsquery('english', query) || to_tsquery('french', query))
>
>


[GENERAL] Combine multiple text search configuration

2017-11-06 Thread hmidi slim
Hi,
I want to know if I can combine multiple text search configurations when I
tried to use FTS.
Is there any options like this:
*to_tsvector(['english', 'french'], document)*

Trying to create a new text configuration:
*Create text search configuration test (copy=simple)*
*Alter text search configuration test*
*add mapping for asciiword with english_stem,french_stem*

This query doesn't work. How can I combine multiple text search
configurations if I need more than one into my query to search a word?