`

Solr: index product and price for sellers and perfoming query and sorting

    博客分类:
  • Solr
阅读更多

In my current project,  the modle seller has multiply products with price,  I want to index products and query them then sorting them by price , seller's credit ,the distance between the seller and the user while highlighting the matched products.

 

Due to solr flatten one-to-many relationship, so I should use multiVlaude field to store products and their prices for a seller. 

The schema likes

<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" /> 
   <field name="name" type="text_ch" indexed="true" stored="true" />
   <field name="district" type="text_ch" indexed="true" stored="true" />
   <field name="location" type="location_rpt" indexed="true" stored="true" multiValued="true"/>
   <field name="commodities" type="text_ch" indexed="true" stored="true" multiValued="true"/>
   <field name="price" type="long" indexed="true" stored="true" multiValued="true"/>

 

the data indexed likes

<doc>
    <str name="id">1</str>
    <str name="name">宜宾燃面</str>
    <arr name="location">
      <str>39.916927,116.363737</str>
    </arr>
    <int name="credit">90</int>
    <str name="district">北京西城区</str>
    <date name="created_at">2015-06-18T15:34:34Z</date>
    <arr name="commodities">
      <str>炒面</str>
      <str>牛肉面</str>
    </arr>
    <arr name="price">
      <long>23</long>
      <long>18</long>
    </arr>
    <long name="_version_">1510459679273123840</long>
    <str name="data_source">seller</str></doc>
  <doc>

 

The option can't sort product by price.

 

How to do it?

---------------------------------------------------

How about to create two cores to meet  my demands?

sellers likes

<doc>
    <str name="id">1</str>
    <str name="name">宜宾燃面</str>
    <arr name="location">
      <str>39.916927,116.363737</str>
    </arr>
    <int name="credit">90</int>
    <str name="district">北京西城区</str>
    <date name="created_at">2015-06-18T15:34:34Z</date>
    <long name="_version_">1510545445415288832</long>
    <str name="data_source">seller</str></doc>
  <doc>

 

products likes

 <doc>
    <str name="id">1</str>
    <str name="name">炒面</str>
    <str name="seller_id">1</str>
    <long name="price">21</long>
    <long name="_version_">1510545648643997696</long></doc>
  <doc>

 

query likes

 "params": {
      "d": "50",
      "indent": "true",
      "spatial": "true",
      "sfield": "location",
      "hl.simple.pre": "<em>",
      "wt": "json",
      "hl": "true",
      "fl": "*,score,dist:geodist()",
      "q": "*:* AND _val_:\"product(scale(credit,1,10),recip(geodist(),3,1,0.1))\"\n",
      "pt": "30.548526,104.062889",
      "_": "1440573751492",
      "hl.simple.post": "</em>",
      "fq": [
        "{!join fromIndex=products toIndex=sellers from=seller_id to=id} name:我要一份牛肉面",
        "{!geofilt}"
      ]

 

but this option can not sort docs by  product's price and highlighting not work.  Meanwhile the product's fileds will not returned.

 

--------------------------------------

How about using nested document model?

but. I found this

All children of a parent document must be indexed together with the parent document. One cannot update any document (parent or child) individually. The entire block needs to be re-indexed of any changes need to be made.

 

Due to seller  updating his products frequently, this option cann't meet our situation.

 

 

--------------------------------------

 

 

 

 

References

http://stackoverflow.com/questions/7845337/sorting-with-multivalued-field-in-solr

http://yonik.com/solr-nested-objects/

 

 

 

分享到:
评论

相关推荐

    node-solr:Node.js 的 Solr 模块

    Node.js 的 Solr 模块参考Node.js: : Solr: : 使用npm test运行测试。 如果您没有在 127.0.0.1:8983 上运行 Solr,请编辑“test/common.js”。使用示例请参阅使用测试。 这是一个快速示例: var solr = require ( ...

    puppet-ispconfig_solr:在 IspConfig 环境中使用的 solr 包装器

    == 定义:ispconfig_solr::instance 这个定义是 solr::instance 的包装器。 它创建一个 solr 实例并配置它以在 IspConfig 环境中使用 == 参数: [ instance_name ] solr 实例的名称。 实例将被称为 solr-$...

    docker-solr:用于Solr的Docker构建,用于管理官方Docker Hub solr映像

    什么是Apache Solr:trade_mark:? Apache Solr具有高度的可靠性,可扩展性和容错性,可提供分布式索引,复制和负载平衡查询,自动故障转移和恢复,集中式配置等。 Solr为许多世界上最大的互联网站点提供搜索和导航...

    solr:Allegro Common Lisp与Solr的接口

    这是Allegro CL的Solr绑定。 Solr是来自Apache Lucene项目的开源自由文本索引/搜索平台。 有关详细信息,请参见以下URL。 该软件包允许Allegro CL应用程序与正在运行的Solr服务器通信,添加和删除文档以及运行查询以...

    solr -8.11.1.zip 文件

    solr -8.11.1.zip 文件

    mir-solr:MIR SOLR配置

    mir-solr:MIR SOLR配置

    java8看不到源码-ansible-role-solr:yauh.solr-用于设置Solr的Ansible角色

    java8 看不到源码Solr 引导程序 设置 Solr 搜索平台的 Ansible 角色 要求 系统上需要有Java,推荐角色yauh.java8。...solr ...solr_source: ...for the Solr process solr_home_system: multicore # the system load

    lucene-solr:Apache Lucene和Solr开源搜索软件

    Solr: : 用Gradle构建 建筑Lucene 参见 。 建筑太阳能 首先,您需要设置开发环境(OpenJDK 11或更高版本)。 我们假设您知道如何获取和设置JDK-如果您不了解,那么我们建议您从开始并进一步了解

    docker-compose 构建以solr8.11.1为基础的含中文分词器的镜像

    以solr8.11.1为基础镜像,使用docker-compose构建含中文分词器的新的镜像 文件夹内含有docker-compose.yml脚本、Dockerfile脚本以及构建镜像所需中文分词器ik-analyzer-8.5.0.jar、所有扩展词和停用词相关的配置文件...

    ansible-role-solr:Ansible角色-Apache Solr

    ansible-role-solr:Ansible角色-Apache Solr

    mod_search_solr:用于 Solr 支持的 Zotonic 模块

    它内置了 Solr:只需安装此模块即可。 设置完成后,Zotonic 会将其保存的每个资源推送到 Solr,以便可以查询数据库。 要将整个站点重新索引到 Solr,请按管理员中的“重建搜索索引”按钮。 安装 您需要为每个要为...

    Solr:将solr与spring boot一起使用

    Spring Boot和Solr 在这个示例中,我们看到如何将spring boot与solr一起用作数据库: Sprint Boot平板电脑索尔我们要做的第一件事是在solr de vehicle中创建模式以保存车辆的信息。 使用此命令,我们将使用bash脚本...

    solr5.4.0完整包

    Solr 依存于Lucene,因为Solr底层的核心技术是使用Lucene 来实现的,Solr和Lucene的本质区别有以下三点:搜索服务器,企业级和管理。...所以说,一句话概括 Solr: Solr是Lucene面向企业搜索应用的扩展。

    nodebb-plugin-solr:使用Apache Solr全文搜索NodeBB

    Solr搜索NodeBB : Solr(发音为“ solar”)是来自Apache Lucene项目的开源企业搜索平台。 它的主要功能包括全文搜索,命中突出显示,多面搜索,动态聚类,数据库集成以及丰富的文档(例如Word,PDF)处理。 此...

    Scaling Big Data with Hadoop and Solr

    Starting with the basics of Apache Hadoop and Solr, this book then dives into advanced topics of optimizing search with some interesting real-world use cases and sample Java code.

    Laravel-4-Solr:Apache Solr简单查询客户端

    Laravel 4 Apache Solr Laravel 4软件包提供了一个接口,用于通过其静态接口使用(查询) 。安装首先通过Composer安装此软件包。 编辑项目的composer.json文件,以要求davispeixoto/laravel-4-solr 。 "require": {...

    Apache-Solr-Reference-Guide-v3.5

    : This section discusses important topics for running and monitoring Solr. It Managing Solr describes running Solr in the Apache Tomcat servlet runner and Web server. Other topics include how to back ...

    Apache Solr(Apress,2015)

    Apache Solr: A Practical Approach to Enterprise Search teaches you how to build an enterprise search engine using Apache Solr. You’ll soon learn how to index and search your documents; ingest data ...

    solr:Apache Solr开源搜索软件

    阿帕奇·索尔(Apache Solr) Apache Solr是一个用Java编写并使用的企业搜索平台。 主要功能包括全文搜索,索引复制和分片以及结果分面和突出显示。在线文件此自述文件仅包含基本的安装说明。 有关更全面的文档,请...

Global site tag (gtag.js) - Google Analytics