问题描述
我有一列名为title的列.我想搜索此列.当我使用title:'sport'
或title:"sport"
之类的单词时,没有问题.两者给出的记录数相同.
I have a column named title. I want to search this column. There is no problem when I use single word like title:'sport'
OR title:"sport"
. Both giving same number of record.
我的问题是,当我搜索2个或多个不带双引号的单词时(带双引号给出确切的结果,例如:title:"sport education"
).
My problem is when I search with 2 or more words without double quotes(with double quotes giving exact result ex: title:"sport education"
).
title:'sport education'
-返回不相关的记录(更多标题没有运动或教育用词)
title:'sport education'
- returning irrelevant records(more title's don't have sport or education word)
+title:'sport education'
-返回与搜索title:'sport' / title:"sport"
相同的记录数.
+title:'sport education'
- returns the same number of record for the search oftitle:'sport' / title:"sport"
.
我应该怎么做才能使列中的任何一个搜索词最少匹配?
what should I do to get atleast any one search word must match in the column?
注意:Solr版本6.3.0
Note: Solr version 6.3.0
提前谢谢!
推荐答案
我敢打赌,您正在寻找的是以下参数链:
I bet what you are looking for is the following chain of parameters:
http://$solr_host:8983/solr/magazines/select&q=sport+education&df=title&q.op=OR
让我为您解密:
- q =体育+教育.您可以自由使用这种自由形式的查询.
- df =标题.在这里,您指定搜索的默认字段.
- q.op = OR(默认设置,可以随时忽略).
$q
将根据$df
fieldType被标记化,并且这些子句将通过OR进行连接,如下所示:title:sport OR title:education
- q=sport+education. You are free to use query in such free form.
- df=title. Here you are specifying default field for search.
- q.op=OR (which is default, feel free to omit it).
$q
will be tokenized according to$df
fieldType and the clauses will be joined via OR like this:title:sport OR title:education
For more information you can follow Common Query Parameters or Local Parameters in Queries.
这篇关于选择查询以在Solr中使用2个或更多单词且不带双引号的单词进行搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!