简体   繁体   English

Coldfusion CFSEARCH:使用Solr索引SQL数据

[英]Coldfusion CFSEARCH: indexing SQL data with Solr

I read the Indexing SQL data chapter of the "Web Application Construction Kit", by Ben Forta. 我阅读了Ben Forta撰写的“ Web应用程序构建工具包”中的“ 索引SQL数据”一章。

Passing a query object to the CFINDEX tag is great for building an index from scratch setting my table's "productName" as the document title, "productDescription" as the body and so on. 将查询对象传递给CFINDEX标记非常适合从头开始建立索引,将表的“ productName”设置为文档标题,将“ productDescription”设置为正文,依此类推。

Anyway, my query produces a result set like this: 无论如何,我的查询会产生如下结果集:

productName    |    attributeType    |    attributeValue

prod1          |    color            |    green
prod1          |    gender           |    man
prod2          |    color            |    blue
prod2          |    gender           |    woman
prod3          |    color            |    green
prod3          |    gender           |    unisex

... and so on. ... 等等。

How do I have to index / search with in order to search " I',m looking for a green watch, I am a man " and be sure to find the "prod1" first? 我该如何索引/搜索才能搜索“ 我正在寻找绿色手表,我是男人 ”,并确保首先找到“ prod1”?

Consider using categories - you have to create a collection which supports categories (it brings a bit of overhead) and provide "category" attribute while indexing db records. 考虑使用类别-您必须创建一个支持类别的集合(这会带来一些开销)并在为db记录建立索引时提供“ category”属性。 Then while searching you can limit your scope to the categories of interest. 然后,在搜索时,您可以将范围限制为感兴趣的类别。 BTW, multiple categories could be applied to the single item if you need to do so. 顺便说一句,如果需要,可以将多个类别应用于单个项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM