Reputation: 9118
Lucene, Elasticsearch: faceted search, full-text search, great!
Neo4j, maybe Titan: graph search awesomeness!
But what are good strategies for queries that combine facets, full-text and graphs? I would not want to materialize graph search results and carry these over into a faceted/full-text query. How to combine these worlds?
Here is an example:
Now we would like to do queries such as:
You could model graphs in Lucene, but that seems a big no-starter. (Prove me wrong!)
You could add facets to Neo4j, but that seems a performance hazard that it is just not optimized for. (But maybe you have different experiences.)
And maybe there is a golden bullet to this problem.
Upvotes: 2
Views: 909
Reputation: 18002
Well, unsurprisingly, it depends. Apologies if this comes across as a somewhat generic answer, but it may be the best you'll get without a lot more specifics on the nature of your challenge.
You need to first outline what your query use cases are, and what the associated data volumes are. If this were a vanilla database and we were trying to optimize your query to make it as quick as possible, we'd first try to identify which portions of your query are the most selective. We'd then push those towards execution first, leaving the less selective bits of your query for execution later. This has the advantage of quickly cutting down on the volume of potential results we're dealing with.
So let's stipulate that you need to do faceted search, full-text search, and graph search. If you can look at your data and what kinds of facets/text/graph patterns you're looking for, in general do the most exclusive/selective thing first.
As far as modeling graphs in lucene, I suppose this could work, but only if the faceted search bits are your biggest need, and the graph bits are fairly primitive. Working with things like shortest path in lucene sounds painful (although I've long since learned not to claim that things are impossible, since almost nothing's impossible if you have enough hours)
Hybrids are also possible (i.e. not using lucene in neo4j, but using them separately and inter-linking them). I hesitate to suggest that without more detail, because it's a powerful (but complicated and costly) way to go.
Upvotes: 1