0

http://localhost:8080/solr/store-products/select?stats=true&start=0&stats.field=storeMinPrice&q=city:(Hyderabad)+AND+Apparel+AND+storeMinPrice:[2941+TO+3000]&q.op =AND&fl=storeMinPrice

结果

<response>
    <lst name="responseHeader">
        <int name="status">0</int>
        <int name="QTime">1</int>
        <lst name="params">
            <str name="fl">storeMinPrice</str>
            <str name="start">0</str>
            <str name="q">
            city:(Hyderabad) AND Apparel AND storeMinPrice:[2941 TO 3000]
            </str>
            <str name="stats.field">storeMinPrice</str>
            <str name="stats">true</str>
            <str name="q.op">AND</str>
        </lst>
    </lst>
    <result name="response" numFound="3" start="0">
        <doc>
            <double name="storeMinPrice">295.0</double>
        </doc>
        <doc>
            <double name="storeMinPrice">299.0</double>
        </doc>
        <doc>
            <double name="storeMinPrice">2970.0</double>
        </doc>
    </result>
    <lst name="stats">
        <lst name="stats_fields">
            <lst name="storeMinPrice">
                <double name="min">295.0</double>
                <double name="max">2970.0</double>
                <long name="count">3</long>
                <long name="missing">0</long>
                <double name="sum">3564.0</double>
                <double name="sumOfSquares">8997326.0</double>
                <double name="mean">1188.0</double>
                <double name="stddev">1543.2585655035257</double>
                <lst name="facets"/>
            </lst>
        </lst>
    </lst>
</response>

我的 schema.xml 是

<?xml version="1.0" encoding="UTF-8" ?>


<schema name="example" version="1.1">
   <types>
        <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>
        <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
        <fieldType name="integer" class="solr.IntField" omitNorms="true"/>
        <fieldType name="long" class="solr.LongField" omitNorms="true"/>
        <fieldType name="float" class="solr.FloatField" omitNorms="true"/>
        <fieldType name="double" class="solr.DoubleField" omitNorms="true"/>
        <fieldType name="sint" class="solr.SortableIntField" sortMissingLast="true" omitNorms="true"/>
        <fieldType name="slong" class="solr.SortableLongField" sortMissingLast="true" omitNorms="true"/>
        <fieldType name="sfloat" class="solr.SortableFloatField" sortMissingLast="true" omitNorms="true"/>
        <fieldType name="sdouble" class="solr.SortableDoubleField" sortMissingLast="true" omitNorms="true"/>
        <fieldType name="date" class="solr.DateField" sortMissingLast="true" omitNorms="true"/>
        <fieldType name="random" class="solr.RandomSortField" indexed="true" />
       <fieldType name="text_ws" class="solr.TextField" positionIncrementGap="100">
            <analyzer>
                <tokenizer class="solr.WhitespaceTokenizerFactory"/>
            </analyzer>
        </fieldType>
       <fieldType name="text" class="solr.TextField" positionIncrementGap="100">
           <analyzer type="index">
                    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
                    <charFilter class="solr.HTMLStripCharFilterFactory"/> 
                        <filter class="solr.StopFilterFactory"
                ignoreCase="true"
                words="stopwords.txt"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
      <analyzer type="query">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>


    <!-- Less flexible matching, but less false matches.  Probably not ideal for product names,
         but may be good for SKUs.  Can insert dashes in the wrong place and still match. -->
    <fieldType name="textTight" class="solr.TextField" positionIncrementGap="100" >
      <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="false"/>
        <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt"/>
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>

    <!--
     Setup simple analysis for spell checking
     -->
    <fieldType name="textSpell" class="solr.TextField" positionIncrementGap="100" >
      <analyzer>
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>

    <!-- This is an example of using the KeywordTokenizer along
         With various TokenFilterFactories to produce a sortable field
         that does not include some properties of the source text
      -->
    <fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory" />
        <filter class="solr.TrimFilterFactory" />
        <filter class="solr.PatternReplaceFilterFactory"
                pattern="([^a-z])" replacement="" replace="all"
        />
      </analyzer>
    </fieldType>
    <fieldtype name="ignored" stored="false" indexed="false" class="solr.StrField" />
    <fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
    <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
    <fieldType name="searchtext" class="solr.TextField" positionIncrementGap="100" omitNorms="true"> 
        <analyzer type="index">
          <tokenizer class="solr.KeywordTokenizerFactory"/>
           <filter class="solr.LowerCaseFilterFactory"/>
         </analyzer>
    </fieldType>
 </types>


  <fields>
   <field name="storeId" type="integer" indexed="true"   stored="true" required="true" /> 
   <field name="storeProductId" type="integer" indexed="true"   stored="true" required="true" />
   <field name="noOfNamedRelatedStores" type="integer" indexed="true"   stored="true" required="false" />
   <field name="hasRelatedStores" type="boolean" indexed="true"    stored="true" required="false" />
   <field name="addressId" type="integer" indexed="true"   stored="true" required="false" />
   <field name="latitude" type="double" indexed="true"   stored="true" required="true" />
   <field name="longitude" type="double" indexed="true"   stored="true" required="true" />
   <field name="city" type="string" indexed="true"   stored="true" required="true" />
   <field name="location" type="string" indexed="true"   stored="true" required="true" />
   <field name="urlLocation" type="string" indexed="true"   stored="true" required="false" />
   <field name="addressLine1" type="string" indexed="true"   stored="true" required="false" />
   <field name="addressLine2" type="string" indexed="true"   stored="true" required="false" />
   <field name="landmark" type="string" indexed="true"   stored="true" required="false" />
   <field name="zipcode" type="string" indexed="true"    stored="true" required="false" /> 
   <field name="storeName" type="string" indexed="true"    stored="true" required="false" />
   <field name="storeUrlName" type="string" indexed="true"    stored="true" required="false" />

   <field name="cityId" type="integer" indexed="true"    stored="true" required="false" /> 
   <field name="active" type="boolean" indexed="true"    stored="true" required="false" />
   <field name="description" type="text" indexed="true"    stored="true" required="false" />
   <field name="webSiteUrl" type="string" indexed="true"    stored="true" required="false" />
   <field name="email" type="string" indexed="true"    stored="true" required="false" />
   <field name="phone" type="string" indexed="true"    stored="true" required="false" />
   <field name="mobile" type="string" indexed="true"    stored="true" required="false" />
   <field name="storeTypeId" type="integer" indexed="true"    stored="true" required="false" /> 
   <field name="clientRelationShipType" type="integer" indexed="true" stored="true" required="false" />
   <field name="storeImage" type="string" indexed="true"    stored="true" required="false" />

   <field name="productId" type="integer" indexed="true"   stored="true" required="true" /> 
   <field name="productName" type="string" indexed="true"   stored="true" required="true" />
   <field name="productUrlName" type="string" indexed="true"   stored="true" required="false" />
   <field name="productDescription" type="text" indexed="true"   stored="true" required="false" />
   <field name="productImage" type="string" indexed="true"    stored="true" required="false" />
   <field name="brandId" type="integer" indexed="true"   stored="true" required="true" />
   <field name="brandName" type="string" indexed="true"   stored="true" required="true" /> 
   <field name="brandUrlName" type="string" indexed="true"   stored="true" required="false" />
   <field name="categoryId" type="integer" indexed="true"   stored="true" required="true" />
   <field name="categoryName" type="string" indexed="true"   stored="true" required="true" />
   <field name="categoryUrlName" type="string" indexed="true"   stored="true" required="true" />
   <field name="menuDisplayName" type="string" indexed="true"   stored="true" required="true" />
   <field name="storeMinPrice" type="double" indexed="true"   stored="true" required="true" />
   <field name="storeMaxPrice" type="double" indexed="true"   stored="true" required="true" />
   <field name="discountPercentage" type="double" indexed="true"    stored="true" required="false" />
   <field name="buyX" type="integer" indexed="true"    stored="true" required="false" />
   <field name="getY" type="integer" indexed="true"    stored="true" required="false" />
   <field name="groupId" type="integer" indexed="true"    stored="true" required="false" />
   <field name="storeCount" type="integer" indexed="true"    stored="true" required="false" />
   <field name="author" type="string" indexed="true"    stored="true" required="false" />
   <field name="isbn10" type="string" indexed="true"    stored="true" required="false" />
   <field name="isbn13" type="string" indexed="true"    stored="true" required="false" />
   <field name="olid" type="string" indexed="true"    stored="true" required="false" />
   <field name="ean13" type="string" indexed="true"    stored="true" required="false" />
   <field name="upca" type="string" indexed="true"    stored="true" required="false" />
   <field name="upce" type="string" indexed="true"    stored="true" required="false" />
   <field name="sku" type="string" indexed="true"    stored="true" required="false" />
   <field name="language" type="string" indexed="true"    stored="true" required="false" />
   <field name="format" type="string" indexed="true"    stored="true" required="false" />
   <field name="publisher" type="string" indexed="true"    stored="true" required="false" />
   <field name="subject" type="string" indexed="true"    stored="true" required="false" />

   <field name="storeProperties" type="string" indexed="true"    stored="true" required="false" multiValued="true"/>
   <field name="specifications" type="string" indexed="true"    stored="true" required="false" multiValued="true"/>
   <field name="latlong" type="location" indexed="true" stored="true"/>
   <field name="text" type="text" indexed="true" stored="false" multiValued="true"/>
   <field name="suggestion_text" type="searchtext" indexed="true" stored="false" multiValued="true" omitNorms="true" omitTermFreqAndPositions="false"/>




   <dynamicField name="*_i"  type="integer"    indexed="true"  stored="true"/>
   <!--<dynamicField name="*"  type="string"  indexed="true"  stored="true" /> -->
   <dynamicField name="*_s"  type="string"  indexed="true"  stored="true" required="false" />
   <dynamicField name="*_l"  type="slong"   indexed="true"  stored="true"/>
   <dynamicField name="*_t"  type="text"    indexed="true"  stored="true"/>
   <dynamicField name="*_b"  type="boolean" indexed="true"  stored="true"/>
   <dynamicField name="*_f"  type="sfloat"  indexed="true"  stored="true"/>
   <dynamicField name="*_d"  type="sdouble" indexed="true"  stored="true"/>
   <dynamicField name="*_dt" type="date"    indexed="true"  stored="true"/>
   <dynamicField name="random*" type="random" />
   <dynamicField name="*_coordinate"  type="tdouble" indexed="true"  stored="false" />
 </fields>


 <uniqueKey>storeProductId</uniqueKey>

 <!-- field for the QueryParser to use when an explicit fieldname is absent -->
 <defaultSearchField>text</defaultSearchField>

 <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
 <solrQueryParser defaultOperator="OR"/>
     <copyField source="storeId" dest="text"/>
     <copyField source="storeProductId" dest="text"/>
     <copyField source="noOfNamedRelatedStores" dest="text"/>
     <copyField source="hasRelatedStores" dest="text"/>
     <copyField source="addressId" dest="text"/>
     <copyField source="latitude" dest="text"/>
     <copyField source="longitude" dest="text"/>
     <copyField source="city" dest="text"/>
     <copyField source="location" dest="text"/>
     <copyField source="urlLocation" dest="text"/>
     <copyField source="addressLine1" dest="text"/>
     <copyField source="addressLine2" dest="text"/>
     <copyField source="zipcode" dest="text"/>
     <copyField source="storeName" dest="text"/>
     <copyField source="storeUrlName" dest="text"/>
     <copyField source="cityId" dest="text"/>
     <copyField source="description" dest="text"/>
     <copyField source="webSiteUrl" dest="text"/>
     <copyField source="email" dest="text"/>
     <copyField source="phone" dest="text"/>
     <copyField source="mobile" dest="text"/>
     <copyField source="storeTypeId" dest="text"/>
     <copyField source="clientRelationShipType" dest="text"/>
     <copyField source="storeImage" dest="text"/>
     <copyField source="productId" dest="text"/>
     <copyField source="productName" dest="text"/>
     <copyField source="productUrlName" dest="text"/>
     <copyField source="productDescription" dest="text"/>
     <copyField source="productImage" dest="text"/>
     <copyField source="brandId" dest="text"/>
     <copyField source="brandName" dest="text"/>
     <copyField source="brandUrlName" dest="text"/>
     <copyField source="categoryId" dest="text"/>
     <copyField source="categoryName" dest="text"/>
     <copyField source="categoryUrlName" dest="text"/>
     <copyField source="menuDisplayName" dest="text"/>
     <copyField source="groupId" dest="text"/>
     <copyField source="storeCount" dest="text"/>
     <copyField source="author" dest="text"/>
     <copyField source="isbn10" dest="text"/>
     <copyField source="isbn13" dest="text"/>
     <copyField source="olid" dest="text"/>
     <copyField source="ean13" dest="text"/>
     <copyField source="upca" dest="text"/>
     <copyField source="upce" dest="text"/>
     <copyField source="language" dest="text"/>
     <copyField source="format" dest="text"/>
     <copyField source="publisher" dest="text"/>
     <copyField source="subject" dest="text"/>



     <copyField source="city" dest="suggestion_text"/>
     <copyField source="location" dest="suggestion_text"/>
     <copyField source="zipcode" dest="suggestion_text"/>
     <copyField source="storeName" dest="suggestion_text"/>
     <copyField source="productName" dest="suggestion_text"/>
     <copyField source="brandName" dest="suggestion_text"/>
     <copyField source="categoryName" dest="suggestion_text"/>
     <copyField source="author" dest="suggestion_text"/>
     <copyField source="isbn10" dest="suggestion_text"/>
     <copyField source="isbn13" dest="suggestion_text"/>
     <copyField source="olid" dest="suggestion_text"/>
     <copyField source="ean13" dest="suggestion_text"/>
     <copyField source="upca" dest="suggestion_text"/>
     <copyField source="upce" dest="suggestion_text"/>
     <copyField source="language" dest="suggestion_text"/>
     <copyField source="format" dest="suggestion_text"/>
     <copyField source="publisher" dest="suggestion_text"/>
     <copyField source="subject" dest="suggestion_text"/>

</schema>
4

1 回答 1

1

看起来这是DoubleField范围查询的规定行为。根据该类的 API 文档,“值将按 unicode 字符串顺序进行评估,而不是数字顺序”,并且“新模式应使用TrieDoubleField ”。TrieDoubleField 用于最新版本的示例 Solr schema中“double”的字段定义。

于 2013-05-21T16:05:14.610 回答