mingfang commented on issue #1639:
URL: https://github.com/apache/age/issues/1639#issuecomment-1979360630

   Yes I can respect that perspective.
   My use case is to integrate AGE with native Postgres FTS.
   Here is what I have working so far.
   ```sql
   CREATE EXTENSION IF NOT EXISTS age;
   
   LOAD 'age';
   SET search_path = ag_catalog, "$user", public;
   
   SELECT * FROM ag_catalog.drop_graph('movie_recommendation', true);
   SELECT * FROM ag_catalog.create_graph('movie_recommendation');
   
   SELECT * from cypher('movie_recommendation', $$
   CREATE 
   (:User {id: 'user1'}),
   (:User {id: 'user2'}),
   (:Movie {id: 'movie1', name: 'The Shawshank Redemption'}),
   (:Movie {id: 'movie2', name: 'The Godfather'}),
   (:Movie {id: 'movie3', name: 'The Dark Knight'}),
   (:Movie {id: 'movie4', name: 'Army of Thieves'}),
   (:Movie {id: 'movie5', name: 'Oceans Thirteen'}),
   (:Movie {id: 'movie6', name: 'Heat'}),
   (:Genre {name: 'Drama'}),
   (:Genre {name: 'Crime'}),
   (:Genre {name: 'Action'})
   $$) as (V agtype);
   
   SELECT * from cypher('movie_recommendation', $$
   
   MATCH 
   (u1:User {id: 'user1'}), 
   (u2:User {id: 'user2'}), 
   (m1:Movie {id: 'movie1'}),
   (m2:Movie {id: 'movie2'}),
   (m3:Movie {id: 'movie3'}),
   (m4:Movie {id: 'movie4'}),
   (m5:Movie {id: 'movie5'}),
   (m6:Movie {id: 'movie6'}),
   (gD:Genre {name: 'Drama'}),
   (gC:Genre {name: 'Crime'}),
   (gA:Genre {name: 'Action'})
   
   CREATE 
   (u1)-[:WATCHED]->(m1),
   (u1)-[:WATCHED]->(m2),
   (u2)-[:WATCHED]->(m1),
   (m1)-[:BELONGS_TO]->(gD),
   (m2)-[:BELONGS_TO]->(gC),
   (m3)-[:BELONGS_TO]->(gA),
   (m4)-[:BELONGS_TO]->(gD),
   (m5)-[:BELONGS_TO]->(gC),
   (m6)-[:BELONGS_TO]->(gA)
   
   $$) as (V agtype);
   
   ALTER TABLE movie_recommendation."Movie" ADD COLUMN ts tsvector
       GENERATED ALWAYS AS (
           to_tsvector('english', ag_catalog.agtype_access_operator(properties, 
'"name"'::ag_catalog.agtype)::text)
       ) STORED;
   CREATE INDEX ts_idx ON movie_recommendation."Movie" USING GIN (ts);    
   
   SELECT *, ts_rank(ts, websearch_to_tsquery('english', 'dark')) AS rank 
   FROM movie_recommendation."Movie" 
   WHERE ts @@ websearch_to_tsquery('english', 'dark');
   ```
   
   The alternative to adding the auto generated column is the add a trigger to 
write to a non-AGE table.
   I think searching, both FTS and vector/embedding based search, are huge in 
the gen-ai era and I'm hoping AGE can support for it.
   What do you recommend as an alternative?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@age.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to