Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Solr从MySQL索引多个表_Mysql_Indexing_Solr_Multiple Tables - Fatal编程技术网

Solr从MySQL索引多个表

Solr从MySQL索引多个表,mysql,indexing,solr,multiple-tables,Mysql,Indexing,Solr,Multiple Tables,我有以下几个表 1. user(user_id,email) 2. tweets(tweet_id,user_id,tweet) 3. tags(tag_id,tag) 4. tweets_tags(tweet_id,tag_id) 我想在应用程序的“我的推文”选项卡下显示当前用户的推文。我想从Solr获得以下数据 user_id email tweet where user_id=x tags where tweet_id=xx 如何在Solr上索引这些mysql表?我只知道s

我有以下几个表

 1. user(user_id,email) 
 2. tweets(tweet_id,user_id,tweet) 
 3. tags(tag_id,tag)
 4. tweets_tags(tweet_id,tag_id)
我想在应用程序的“我的推文”选项卡下显示当前用户的推文。我想从Solr获得以下数据

user_id
email
tweet where user_id=x
tags where tweet_id=xx
如何在Solr上索引这些mysql表?我只知道
schema.xml
data config.xml
完整/增量导入的代码

注意:我不是问MySQL连接器等问题,我已经问过了

如果您使用的是DIH(dataimporterhandler),我想该链接应该是您的解决方案:
如果您在编写确切的配置时有问题,请让我知道,我可以帮助您

您描述的用例似乎不能证明使用solr是合理的。您只需确保您有适当的键和索引,并直接在mysql中执行

如果出于某种原因,您必须使用solr,那么您可能需要准备所有数据,并以这样的标记/tweet/用户结构将其提供给solr

  • user1-tweet1-tag1
  • user1-tweet1-tag2
  • user1-tweet2-tag1
等等

然后从solr中按用户查询,然后按tweet排序和分组,然后标记。 但是,我必须再次声明,我刚才描述的解决方案是通过使用普通sql实现的,实现起来更安全,结果更可靠


如果您能提供更多关于所需结果的详细信息,我很乐意为您提供数据库结构、必要的外键和索引以及获取数据所需的查询。

我已经阅读了该页面,我需要知道的是,有些查询非常复杂,我们需要使用php数组处理它们,运行一个查询,获取结果,然后使用结果中的数据运行另一个查询。如何使用多个实体或多个核心索引这样的数据。我建议使用子实体。假设您希望显示来自所有表的结果(solr core joins查询很慢,非常慢),为了加快导入速度,您可以创建物化视图,并在导入时使用子实体:同意这个答案。我对SOLR POC也有类似的要求,我的做法是对数据进行非规范化,并将该查询提供给DataImportHandler。