douping6871 2010-01-26 18:00
浏览 64
已采纳

我应该在Solr(或任何数据库)中索引或存储这些字段吗?

Background:
I have a cclassifieds website, and users may for example search for cars, and specify a price range, mileage, fueltype, gearbox and a manually inputted query-string if they like to put something specific into the search, ex "bmw m3".

Questions:
I am about to move this information to Solr for faster lookup, and wonder if I have to index or store the fields.

The only fields where users can search in is actually the "headline" and the "description" of the classified. They can however as I mention above, specify price ranges for example.

So I guess the "headline" and "description" fields should be indexed right? But should the price field, and any other sub-option fields also be indexed?

In a MySQL query the query-syntax would be something like this, so you can compare to what I am talking about: (may contain errors, forgot exactly how they where written)

  $query="SELECT * FROM cars_category WHERE headline='bmw m3' OR description='bmw m3' AND price BETWEEN 10000 AND 500000 AND fuel='petrol' AND etc etc";

So what do you think, index/store all fields or what?

Is there a method for determining what to store and what to index, or both?

Thanks

PS: Descriptive answers are appreciated

  • 写回答

3条回答 默认 最新

  • dongtong2021 2010-01-26 21:35
    关注

    and wonder if I have to index or store the fields.

    My understanding of Solr is very limited, but what confused me when I started was the indexing terminology: in a database, storing the data and creating/storing an index are two separate things and (generally speaking, at least) data is stored in two separate places, but in Solr, anything you upload to Solr is indexed. So you decide which fields you want Solr to be able to search, and you assign field types and - hey presto - Solr can find data in those field with impressive speed. You can determine how different fields are searched (case sensitive or not, for example) and you can determine range searches and the like: check out the wiki here http://wiki.apache.org/solr/FrontPage#Search_and_Indexing and the query syntax http://wiki.apache.org/solr/SolrQuerySyntax for comprehensive treatment of these.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 LiBeAs的带隙等于0.997eV,计算阴离子的N和P
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 来真人,不要ai!matlab有关常微分方程的问题求解决,
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算