热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

关于SOLR文档的问题等等-QuestionsaboutSOLRdocumentsandsomemore

Website:Classifiedswebsite(usersmayputads,searchadsetc)网站:分类广告网站(用户可以投放广告,搜索广告等)Iplant

Website: Classifieds website (users may put ads, search ads etc)

网站:分类广告网站(用户可以投放广告,搜索广告等)

I plan to use SOLR for searching and then return results as ID nr:s only, and then use those ID nr:s and query mysql, and then lastly display the results with those ID:s.

我打算使用SOLR进行搜索,然后将结果作为ID nr:s返回,然后使用那些ID nr:s并查询mysql,最后用这些ID显示结果:s。

Currently I have around 30 tables in MySQL, one for each category.

目前我在MySQL中有大约30个表,每个类别一个。

1- Do you think I should do it differently than above?

1-你认为我应该采取与上述不同的方式吗?

2- Should I use only one SOLR document, or multiple documents? Also, is document the same as a SOLR index?

2-我应该只使用一个SOLR文档还是多个文档?此外,文档是否与SOLR索引相同?

3- Would it be better to Only use SOLR and skip MySQL knowing that I have alot of columns in each table? Personally I am much better at using MySQL than SOLR.

3-仅使用SOLR并跳过MySQL知道我在每个表中有很多列会更好吗?就个人而言,我比使用SOLR更善于使用MySQL。

4- Say the user wants to search for cars in a specific region, how is this type of querying performed/done in SOLR? Ex: q=cars®ion=washington possible?

4-假设用户想要搜索特定区域的汽车,在SOLR中如何执行/完成此类查询?例如:q =汽车和地区=华盛顿可能吗?

You may think there is alot of info about SOLR out there, but there isn't, and especially not about using PHP with SOLR and a SOLR php client... Maybe I will write something when I have learned all this... Or maybe one of you could write something up!

您可能认为有很多关于SOLR的信息,但是没有,特别是没有使用PHP与SOLR和SOLR php客户端...也许我会在我学会了这些之后写些东西...或者也许你们其中一个人可以写点东西!

Thanks again for all help...

再次感谢所有帮助......

4 个解决方案

#1


7  

First, the definitions: a Solr/Lucene document is roughly the equivalent of a database row. An index is roughly the same as a database table.

首先,定义:Solr / Lucene文档大致相当于数据库行。索引与数据库表大致相同。

I recommend trying to store all the classified-related information in Solr. Querying Solr and then the database is inefficient and very likely unnecessary.

我建议尝试将所有与分类相关的信息存储在Solr中。查询Solr然后数据库是低效的,很可能是不必要的。

Querying in a specific region would be something like q=cars+region:washington assuming you have a region field in Solr.

在特定区域查询将类似q = cars + region:washington假设您在Solr中有一个区域字段。

The Solr wiki has tons of good information and a pretty good basic tutorial. Of course this can always be improved, so if you find anything that isn't clear please let the Solr team know about it.

Solr wiki拥有大量优秀的信息和非常好的基础教程。当然这可以随时改进,所以如果你发现任何不清楚的地方,请让Solr团队了解它。

I can't comment on the PHP client since I don't use PHP.

因为我不使用PHP,所以无法对PHP客户端发表评论。

#2


0  

Solr is going to return it's results in a syntax easily parsible using SimpleXml. You could also use the SolPHP client library: http://wiki.apache.org/solr/SolPHP.

Solr将使用SimpleXml以易于解析的语法返回结果。您还可以使用SolPHP客户端库:http://wiki.apache.org/solr/SolPHP。

Solr is really quite efficient. I suggest putting as much data into your Solr index as necessary to retrieve everything in one hit from Solr. This could mean much less database traffic for you.

Solr非常有效率。我建议根据需要将尽可能多的数据放入Solr索引,以便从Solr中检索所有内容。这可能意味着您的数据库流量要少得多。

If you've installed the example Solr application (comes with Jetty), then you can develop Solr queries using the admin interface. The URI of the result is pretty much what you'd be constructing in PHP.

如果您已经安装了示例Solr应用程序(Jetty附带),那么您可以使用管理界面开发Solr查询。结果的URI几乎就是你在PHP中构建的。

The most difficult part when beginning with Solr is getting the solrconfig.xml and the schema.xml files correct. I suggest starting with a very basic config, and restart your web app each time you add a field. Starting off with the whole schema.xml can be confusing.

从Solr开始时最困难的部分是使solrconfig.xml和schema.xml文件正确。我建议从一个非常基本的配置开始,并在每次添加字段时重新启动您的Web应用程序。从整个schema.xml开始可能会令人困惑。

#3


0  

2- Should I use only one SOLR document, or multiple documents? Also, is document the same as a SOLR index?

2-我应该只使用一个SOLR文档还是多个文档?此外,文档是否与SOLR索引相同?

3- Would it be better to Only use SOLR and skip MySQL knowing that I have alot of columns in each table? Personally I am much better at using MySQL than SOLR.

3-仅使用SOLR并跳过MySQL知道我在每个表中有很多列会更好吗?就个人而言,我比使用SOLR更善于使用MySQL。

A document is "an instance" of solr index. Take into account that you can build only one solr index per solr Core. A core acts as an independent solr Server into the same solr insallation.

文档是solr索引的“实例”。考虑到每个solr Core只能构建一个solr索引。核心作为独立的solr Server充当相同的solr insallation。

http://wiki.apache.org/solr/CoreAdmin

Yo can build one index merging some table contents and some other indexes to perform second level searches...

Yo可以构建一个索引合并一些表内容和一些其他索引来执行二级搜索...

would you give more details about your architecture and data??

你会提供有关你的架构和数据的更多细节吗?

#4


0  

As suggested by others you can store and index your mysql data and can run query in solr index, thus making mysql unnecessary to use. You don't need to just store and index ids and query and get ids and then run mysql query to get additional data against that id. You can just store other data corresponding to ids in solr itself.

正如其他人所建议的那样,你可以存储和索引你的mysql数据,并可以在solr索引中运行查询,从而使得mysql不必使用。您不需要只存储和索引ID并查询和获取ID,然后运行mysql查询以获取针对该ID的其他数据。您可以在solr中存储与id相对应的其他数据。

Regarding solr PHP client, then you don't need to use and it is recommended to directly use REST like Solr Web API. You can use PHP function like file_get_contents("http://IP:port/solr/#/core/select?q=query&start=0&rows=100&wt=json") or use curl with PHP if you need to. Both ways are almost same and efficient. This will return data in json as wt=json. Then use PHP function json_decode($returned_data) to get that data in object.

关于so​​lr PHP客户端,那么你不需要使用,建议直接使用像Solr Web API这样的REST。您可以使用PHP函数,如file_get_contents(“http:// IP:port / solr /#/ core / select?q = query&start = 0&rows = 100&wt = json”),或者如果需要,可以使用curl和PHP。两种方式几乎相同且有效。这将返回json中的数据为wt = json。然后使用PHP函数json_decode($ returned_data)在对象中获取该数据。

If you need to ask anything just reply.

如果您需要回答任何问题。


推荐阅读
author-avatar
as2520_526
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有