Organizations struggle to glean insightful information from constantly growing amounts of data in today’s data-driven environment. Complex relationship modeling is a strength of graph databases, and full-text search effectively extracts relevant information from unstructured data. Separate system maintenance for these functions, however, may result in overhead and delayed insights. A single, tightly integrated solution combining both functionalities is provided by Spanner Graph. We’ll explore the features and benefits of using Spanner Graph with full-text search in this blog post.
Full-text search and graphing are an effective combination
Since graphs naturally convey links in data, they are an excellent tool for studying linked data, spotting hidden patterns, and enabling applications that depend on connection knowledge. Graph databases excel at handling data’s intricate web of links, making them useful for social networks, recommendation engines, fraud detection, and supply chain management.
Unstructured data emails, text documents, social network posts, and consumer reviews are also abundant. Full-text search engines can index, discover, and locate relevant material in massive unstructured data warehouses. Knowledge discovery, customer service, and content management require full-text search to swiftly and conveniently find information. While full-text search and graph databases are valuable individually, they work best together.
Assume you are creating an online store: Your website quickly finds related products when a consumer searches for “waterproof hiking boots” by using a full-text search on product descriptions. Next, using the power of graphs, your recommendation engine examines the customer’s previous purchases of hiking socks and backpacks as well as the purchasing patterns of other customers who have made comparable boot purchases. By combining these facts, your website may effectively cross-sell and improve the user’s buying experience by returning waterproof hiking boots that match the user’s search as well as recommending related products like trekking poles that the user hasn’t yet bought. Full-text search and graph combine to enable this customized method.
It is not ideal to use many specialized systems
Currently, managing full-text and graph data frequently requires using two different kinds of systems: search engines and graph databases. This presents a number of difficulties:
- Problems with data duplication and synchronization: Complex ETL processes for data copying and transformation are required to maintain consistency across distinct graph and full-text search engines. This results in the waste of important resources and increases the possibility of mistakes and delays.
- Increased operational complexity and maintenance costs are a result of operating a large number of specialized services. Every service requires configuration, security upgrades, monitoring, and sometimes troubleshooting, which takes time and specialized knowledge.
- Performing integrated searches and analysis is hampered by the division of full-text and graph search functions. It is frequently necessary to manually combine and correlate the results of different queries in order to bring together insights from both areas.
- Impact on real-time application responsiveness: Applications where quick insights are critical, such as fraud detection, customer support, and real-time recommendations, may be adversely affected by the inherent latency brought on by data synchronization and independent query processing.
Spanner Graph integrates full-text search and graph functionality into a single system
Spanner Graph integrates Spanner, its globally consistent, always-on database with built-in graph features, to create an almost infinitely scalable database. One system has a tight integration of graph, full-text search, and AI features. The integrated full-text search offers tried-and-true technology, the foundation of many current Google products. It incorporates fuzzy matching for character variations and names with similar sounds in addition to precise or partial matches, result scoring, and automatic language detection. Additionally, it makes use of AI to interpret search terms, managing synonyms and spelling checks. It also enables sophisticated search queries with logical operators, just like the web search function on Google.
Graph queries and full-text search are closely coupled so that you can use one to explore relationships inside graph structures and the other to retrieve nodes or edges based on text content. This unified capability, which serves as your single source of truth, unifies two complementary methodologies to reveal insights, patterns, and hidden linkages across unstructured and graph data, all within one system.
Establish a full-text search index on the edges and nodes of the graph
Creating a search index on the graph node and edge properties you wish to search on is the first step towards using full-text search with Spanner Graph. Tables and their columns are mapped to graph nodes, edges, and their attributes using the Spanner Graph. You can establish a search index on the related table columns to enable full-text search on a text property of graph nodes and edges.
You first build a retail graph using a condensed example from the e-commerce domain, in which the product and the user are entities and the relationships are past purchases:
Add a new column descriptionToken of type TOKENLIST to the underlying Product table to store the tokenized content of the description column in order to enable product searches based on this property:
Next, a search index on the tokenized description can be created:
To locate graph nodes, using full-text search
Full-text search on Spanner Graph can be accessed via the SEARCH function once the search index has been constructed. Two parameters are passed to the SEARCH function: the property to search on and the input search query. The product nodes that have the term “waterproof hiking boots” in their description are returned in the example below:
Integrate graph traversals with full-text search
Combining graph traversals with full-text search yields the true power. Full-text search can be used to rapidly identify pertinent graph nodes that serve as the foundation for more investigation. After that, to navigate relationships, you can use graph queries. It would be challenging to find hidden connections, patterns, and insights using each technique alone; but, this combination reveals them.
Expanding on the last example, the following scenario shows graph traversal in the context of recommendation engines, beginning with products found using full-text search. The graph query finds users who have already bought each product. It then finds other things that those users have purchased as well, and returns those results as product recommendations based on popularity. The number of distinct buyers who have previously bought the item is used to determine how popular the product is. Please take note that the things the current user has already purchased cannot be returned. This procedure successfully exposes the client base’s connected preferences and patterns of buying.
Combined table data and query graph
By enabling complete compatibility between SQL and the Graph Query Language (GQL), Spanner Graph connects the graph and relational languages. GQL allows you to navigate through your graphs and join the results with tables in a single query. This gives you the most freedom to select the appropriate tool for the task at hand and achieve the best possible results. An even more basic recommendation system that makes use of both graphs and full-text search is demonstrated in the example that follows. In addition to making product recommendations, this query uses SQL to get the suggested products’ historical pricing data from a table, giving consumers insightful information about price trends and fluctuations.
Begin now
Discover hidden insights in your data with the potent mix of full-text search, graph, and SQL interoperability. This will change the way you examine, evaluate, and comprehend your information landscape.