简体   繁体   中英

Solr proximity search return no result

The query I'm using is q=name:"william test bay"~2 .

Schema.xml has the following:

  <field name="name" type="text_en" indexed="true" stored="true"/>

The follow two is the response I want to return but in fact no result is returned:

"response": {
    "numFound": 2,
    "start": 0,
    "docs": [
      {
        "id": "3",
        "name": "william bay",
        "_version_": 1561163645757423600
      },
      {
        "id": "4",
        "name": "william bay photography",
        "_version_": 1561163645757423600
      }
    ]
  }

I'd like to know why. For example, I want to match "william test bay" to "william bay". I thought the edit distance is 1, just delete term "test"? In fact even name:"william test bay"~1000 doesn't work.

Currently using Solr 4.10.3. This is the one used by Cloudera Search so I couldn't upgrade it.

Proximity Searches

In Proximity all the phrase query keyword has to be present in document. In your case test keyword is not present. That's why you are not getting any result.

A proximity search looks for terms that are within a specific distance from one another.
The distance referred to here is the number of term movements needed to match the specified phrase .But not to delete the keyword from the phrase query.
[Example]

text : william bay photography
query : william photography

To match above query distance has to be one. Because only one word has to be moved for search string to matched with the text.

q:"william photography"~1

您可以尝试使用查询: q=name:(william test bay)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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