We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(keep adjusting)
// Unique constraints CREATE CONSTRAINT content_id IF NOT EXISTS FOR (c:Content) REQUIRE c.id IS UNIQUE; CREATE CONSTRAINT category_name IF NOT EXISTS FOR (c:Category) REQUIRE c.name IS UNIQUE; CREATE CONSTRAINT subcategory_name IF NOT EXISTS FOR (s:SubCategory) REQUIRE s.name IS UNIQUE; CREATE CONSTRAINT tag_name IF NOT EXISTS FOR (t:Tag) REQUIRE t.name IS UNIQUE; // Vector index for semantic search CREATE VECTOR INDEX content_embedding IF NOT EXISTS FOR (c:Content) ON (c.textEmbedding) OPTIONS { indexConfig: { `vector.dimensions`: 768, `vector.similarity_function`: 'cosine' } };
2, Create Content with Relationships:
// Create or match existing category MERGE (cat:Category {name: $categoryName}) // Create or match existing subcategory WITH cat MERGE (subcat:SubCategory {name: $subcategoryName}) MERGE (subcat)-[:CHILD_OF]->(cat) // Create content node with embedding WITH cat, subcat CREATE (c:Content { id: randomUUID(), text: $text, textEmbedding: $embedding, createdAt: datetime(), updatedAt: datetime() }) MERGE (c)-[:BELONGS_TO]->(cat) MERGE (c)-[:SUBCATEGORIZED_AS]->(subcat) // Create tags and relationships WITH c UNWIND $tags as tagName MERGE (t:Tag {name: tagName}) MERGE (c)-[:TAGGED_WITH]->(t)
// Find similar content using vector similarity MATCH (c:Content) WHERE c.textEmbedding IS NOT NULL WITH c, vector.similarity(c.textEmbedding, $searchEmbedding) as score WHERE score > 0.7 // Adjustable threshold RETURN c.text, score, [(c)-[:BELONGS_TO]->(cat) | cat.name] as categories, [(c)-[:TAGGED_WITH]->(t) | t.name] as tags ORDER BY score DESC LIMIT 5
The text was updated successfully, but these errors were encountered:
KazChe
No branches or pull requests
(keep adjusting)
2, Create Content with Relationships:
The text was updated successfully, but these errors were encountered: