Sitecore 内容搜索 (Lucene) - Between<T>() 不起作用

Sitecore Content Search (Lucene) - Between<T>() not work

我正在使用具有内容搜索功能的 Sitecore 8.1 update 1。我的索引配置如下:

(我想按经纬度搜索Broker/Client办公室)

1) 在 index.config

      <fieldMap type="Sitecore.ContentSearch.FieldMap, Sitecore.ContentSearch">
        <fieldNames hint="raw:AddFieldByFieldName">

          <field fieldName="latitude"         storageType="NO" indexType="UNTOKENIZED" vectorType="NO" boost="1f" type="System.Decimal" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
          </field>
          <field fieldName="longitude"         storageType="NO" indexType="UNTOKENIZED" vectorType="NO" boost="1f" type="System.Decimal" settingType="Sitecore.ContentSearch.LuceneProvider.LuceneSearchFieldConfiguration, Sitecore.ContentSearch.LuceneProvider">
          </field>

2) 好的,现在使用Luke.net工具来检查它的值

image in Luke.net tool

3) 我的 SearchResultItem class:

    [IndexField("latitude")]
    public decimal Latitude { get; set; }

    [IndexField("longitude")]
    public decimal Longitude { get; set; }

4) 为我服务 class,我想尝试使用 Between 方法在范围内搜索 Latitude/Longitude,但它不起作用。我尝试了 equal (==) 方法并且它有效。我认为我的索引没问题,但我的搜索语法可能有问题。你能帮忙吗?

    //TODO: Testing -----------------
    var query = searchContext.GetQueryable<BrokerSearchIndexItem>();

    // IF i use this line (BETWEEN) --> NOT work ??
    query = query.Where(item => (item.Latitude.Between(-34, -33, Inclusion.Both)
                                    && item.Longitude.Between(149, 151, Inclusion.Both)));

    // If I use this line (EQUAL) --> work !
    //query = query.Where(item => item.Latitude == -33.737643m && item.Longitude == 150.856664m);

    var searchResult = query.GetResults();

5) 我已经阅读了本教程 (link) 和我的搜索日志,似乎 Between 方法给了我正确的日志,但不确定为什么我什么都没有

    9636 21:10:03 INFO  ExecuteQueryAgainstLucene (steadfast_broker_location): +latitude:[-34 TO -33] +longitude:[149 TO 151] - Filter : 
    9636 21:10:03 INFO  ExecuteQueryAgainstLucene (steadfast_broker_location): +latitude:[-34 TO -33] +longitude:[149 TO 151] - Filter : 
    9636 21:10:03 INFO  ExecuteQueryAgainstLucene (steadfast_broker_location): +latitude:[-34 TO -33] +longitude:[149 TO 151] - Filter : 

查看 Lucene Spatial Search Support module

它将提供:

  • 新的 Sitecore 字段 "Google Map" 将存储 lat/long 并在内容编辑器中提供地图界面。
  • 索引架构更新以存储纬度和经度值。
  • 更新 Sitecore ContentSearch 以提供地理空间搜索方法。

还有一个module for Solr