0

使用 SOLR 7.XI 正在考虑基于 SKU 匹配提升搜索

select?fl=SKU&q=text:234^1 或 SKU:A234-TRIM-WH^10

结果:

<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">0</int>
<lst name="params">
<str name="q">text:234^1 OR SKU:A234-TRIM-WH^10</str>
<str name="fl">SKU</str>
</lst>

<result name="response" numFound="95" start="0">
<doc><str name="SKU">49-234</str></doc>
<doc><str name="SKU">A234-TRIM-PB</str></doc>
<doc><str name="SKU">A234-TRIM-VB</str></doc>
<doc><str name="SKU">A234-TRIM-SDB</str></doc>
<doc><str name="SKU">A234-TRIM-PG</str></doc>
<doc><str name="SKU">A234-TRIM-MBK</str></doc>
<doc><str name="SKU">A234-TRIM-TB</str></doc>
<doc><str name="SKU">A234-TRIM-WH</str></doc>
<doc><str name="SKU">A234-TRIM-SB</str></doc>
<doc><str name="SKU">A234-TRIM-BKN</str></doc>
</result>

我期待 A234-TRIM-WH 成为我的第一个结果。知道我做错了什么吗?

4

1 回答 1

0

通过添加按分数排序可以得到这些期望的结果。^5 表示分数提高了 5。您需要调整排序以实际调整结果。

/select?fl=SKU,score&q=text:234 或 SKU:A234-TRIM-BG^5&sort=score desc

q=text:234 OR SKU:A234-TRIM-BG^5
sort=score desc

    <result name="response" numFound="95" start="0" maxScore="40.91652">
      <doc>
        <str name="SKU">A234-TRIM-BKN</str>
        <float name="score">40.91652</float></doc>
      <doc>
        <str name="SKU">A234-H-BKN</str>
        <float name="score">39.75939</float></doc>
      <doc>
        <str name="SKU">A234-TRIM-ULB</str>
        <float name="score">37.286957</float></doc>
      <doc>
        <str name="SKU">A234-TRIM-SCU</str>
        <float name="score">36.92577</float></doc>
      <doc>
        <str name="SKU">A234-TRIM-PEW</str>
        <float name="score">33.346096</float></doc>
      <doc>
        <str name="SKU">A234-TRIM-WH</str>
        <float name="score">33.346096</float></doc>
      <doc>
        <str name="SKU">A234-TRIM-MBK</str>
        <float name="score">32.955338</float></doc>
      <doc>
        <str name="SKU">A234-TRIM-PCH</str>
        <float name="score">32.955338</float></doc>
      <doc>
        <str name="SKU">A234-TRIM-SC</str>
        <float name="score">32.955338</float></doc>
      <doc>
        <str name="SKU">A234-TRIM-JG</str>
        <float name="score">32.955338</float></doc>
    </result><lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">6</int>
  <lst name="params">
    <str name="q">text:234 OR SKU:A234-TRIM-BG^5</str>
    <str name="fl">SKU,score</str>
    <str name="sort">score desc</str>
    <str name="_">1548816346922</str>
  </lst>
</lst>
<result name="response" numFound="95" start="0" maxScore="74.61354">
  <doc>
    <str name="SKU">A234-TRIM-BG</str>
    <float name="score">74.61354</float></doc>
  <doc>
    <str name="SKU">93-234</str>
    <float name="score">14.38112</float></doc>
  <doc>
    <str name="SKU">SS234#01</str>
    <float name="score">13.502219</float></doc>
  <doc>
    <str name="SKU">A234-TRIM-ULB</str>
    <float name="score">13.497984</float></doc>
  <doc>
    <str name="SKU">A234-TRIM-SCU</str>
    <float name="score">13.194142</float></doc>
  <doc>
    <str name="SKU">THU234</str>
    <float name="score">13.194142</float></doc>
  <doc>
    <str name="SKU">A234-H-AB</str>
    <float name="score">13.09588</float></doc>
  <doc>
    <str name="SKU">A234-H-ACU</str>
    <float name="score">13.09588</float></doc>
  <doc>
    <str name="SKU">A234-H-BG</str>
    <float name="score">13.09588</float></doc>
  <doc>
    <str name="SKU">A234-H-BKN</str>
    <float name="score">13.09588</float></doc>
</result>
于 2019-01-30T02:52:56.490 回答