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 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化