Solr 不搜索整数?

2024-05-25

我目前正在使用 Solr 为电子商务网站开发搜索引擎。所以我在 schema.xml 中得到这两个字段:

   <field name="sku" type="string" indexed="true" stored="true" required="false" />
   <field name="collection" type="string" indexed="true" stored="true" required="false" />

(完整的 schema.xml 如下所示)

欲了解更多信息:

  • sku 看起来像这样:959620、929345、912365,...
  • 系列看起来像这样:Alcott、Spigrim、Tantal,...

它们有很好的索引。例如,当我寻找:

http://localhost:8080/solr/myindex/select/?q=Alcott

我得到了“Alcott”系列的所有产品。

但当我寻找时;

http://localhost:8080/solr/myindex/select/?q=959620

我什么也没得到。

然而,当我深入提出这个要求时,

http://localhost:8080/solr/myindex/select/?q=sku:969520

我确实有此 sku 附带的产品。

有什么方法可以让“q=969520”工作吗?甚至更好:“q=96”导致所有 sku 以“96”开头的产品?

感谢您的帮助 !

架构.xml:

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

<schema name="example" version="1.2">


  <types>

    <fieldType name="string" class="solr.StrField" sortMissingLast="true" omitNorms="true"/>

    <!-- boolean type: "true" or "false" -->
    <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" omitNorms="true"/>
    <!--Binary data type. The data should be sent/retrieved in as Base64 encoded Strings -->
    <fieldtype name="binary" class="solr.BinaryField"/>


    <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
    <fieldType name="float" class="solr.TrieFloatField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
    <fieldType name="long" class="solr.TrieLongField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
    <fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>


    <fieldType name="tint" class="solr.TrieIntField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
    <fieldType name="tfloat" class="solr.TrieFloatField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
    <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>
    <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" omitNorms="true" positionIncrementGap="0"/>


    <fieldType name="date" class="solr.TrieDateField" omitNorms="true" precisionStep="0" positionIncrementGap="0"/>

    <!-- A Trie based date field for faster date range queries and date faceting. -->
    <fieldType name="tdate" class="solr.TrieDateField" omitNorms="true" precisionStep="6" positionIncrementGap="0"/>



    <fieldType name="pint" class="solr.IntField" omitNorms="true"/>
    <fieldType name="plong" class="solr.LongField" omitNorms="true"/>
    <fieldType name="pfloat" class="solr.FloatField" omitNorms="true"/>
    <fieldType name="pdouble" class="solr.DoubleField" omitNorms="true"/>
    <fieldType name="pdate" class="solr.DateField" sortMissingLast="true" 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="random" class="solr.RandomSortField" indexed="true" />


    <!-- A text field that only splits on whitespace for exact matching of words -->
    <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"/>
        <!-- in this example, we will only use synonyms at query time
        <filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
        -->
        <!-- Case insensitive stop word removal.
          add enablePositionIncrements=true in both the index and query
          analyzers to leave a 'gap' for more accurate phrase queries.
        -->
        <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.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
      </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"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="1"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
      </analyzer>
    </fieldType>

    <fieldType name="text_fr" class="solr.TextField" positionIncrementGap="100">

      <analyzer type="query">
        <!-- normalisation des accents, cédilles, e dans l'o,... -->
        <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
        <!-- découpage selon les espaces -->
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <!-- suppression de la ponctuation -->
        <filter class="solr.PatternReplaceFilterFactory" pattern="^(\p{Punct}*)(.*?)(\p{Punct}*)$" replacement="$2"/>
        <!-- suppression des tokens vides et des mots démesurés -->
        <filter class="solr.LengthFilterFactory" min="1" max="100" />
        <!-- passage en minuscules -->
        <filter class="solr.LowerCaseFilterFactory"/>
        <!-- suppression des élisions (l', qu',...) -->
        <filter class="solr.ElisionFilterFactory" articles="elisionwords_fr.txt"/> 
        <!-- découpage des mots composés -->
        <filter class="solr.WordDelimiterFilterFactory" splitOnCaseChange="1" splitOnNumerics="1" stemEnglishPossessive="1" generateWordParts="1"
                                                        generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="1" preserveOriginal="1"/>
        <!-- suppression des mots insignifiants -->
        <filter class="solr.StopFilterFactory" ignoreCase="1" words="stopwords_fr.txt" enablePositionIncrements="true"/>
        <!-- gestion des synonymes -->
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms_fr.txt" ignoreCase="true" expand="true"/>
        <!-- partie de mot -->
        <filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="6"/>
        <!-- lemmatisation (pluriels,...) -->
        <filter class="solr.SnowballPorterFilterFactory" language="French" protected="protwords_fr.txt"/>
        <!-- suppression des doublons éventuels -->
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>



      <analyzer type="index">
        <!-- normalisation des accents, cédilles, e dans l'o,... -->
        <charFilter class="solr.MappingCharFilterFactory" mapping="mapping-ISOLatin1Accent.txt"/>
        <!-- découpage selon les espaces -->
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <!-- suppression de la ponctuation -->
        <filter class="solr.PatternReplaceFilterFactory" pattern="^(\p{Punct}*)(.*?)(\p{Punct}*)$" replacement="$2"/>
        <!-- suppression des tokens vides et des mots démesurés -->
        <filter class="solr.LengthFilterFactory" min="1" max="100" />
        <!-- passage en minuscules -->
        <filter class="solr.LowerCaseFilterFactory"/>
        <!-- suppression des élisions (l', qu',...) -->
        <filter class="solr.ElisionFilterFactory" articles="elisionwords_fr.txt"/> 
        <!-- découpage des mots composés -->
        <filter class="solr.WordDelimiterFilterFactory" splitOnCaseChange="1" splitOnNumerics="1" stemEnglishPossessive="1" generateWordParts="1"
                                                        generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="1" preserveOriginal="1"/>
        <!-- suppression des mots insignifiants -->
        <filter class="solr.StopFilterFactory" ignoreCase="1" words="stopwords_fr.txt" enablePositionIncrements="true"/>
        <!-- gestion des synonymes -->
        <filter class="solr.SynonymFilterFactory" synonyms="synonyms_fr.txt" ignoreCase="true" expand="true"/>
        <!-- partie de mot -->
        <filter class="solr.EdgeNGramFilterFactory" minGramSize="3" maxGramSize="6"/>
        <!-- lemmatisation (pluriels,...) -->
        <filter class="solr.SnowballPorterFilterFactory" language="French" protected="protwords_fr.txt"/>
        <!-- suppression des doublons éventuels -->
        <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.SnowballPorterFilterFactory" language="English" protected="protwords.txt"/>
        <!-- this filter can remove any duplicate tokens that appear at the same position - sometimes
             possible with WordDelimiterFilter in conjuncton with stemming. -->
        <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
      </analyzer>
    </fieldType>


    <!-- A general unstemmed text field - good if one does not know the language of the field -->
    <fieldType name="textgen" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <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="0"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </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"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="0"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>


    <!-- A general unstemmed text field that indexes tokens normally and also
         reversed (via ReversedWildcardFilterFactory), to enable more efficient 
   leading wildcard queries. -->
    <fieldType name="text_rev" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <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="0"/>
        <filter class="solr.LowerCaseFilterFactory"/>
        <filter class="solr.ReversedWildcardFilterFactory" withOriginal="true"
           maxPosAsterisk="3" maxPosQuestion="2" maxFractionAsterisk="0.33"/>
      </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"
                enablePositionIncrements="true"
                />
        <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="0"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldType>


    <fieldType name="alphaOnlySort" class="solr.TextField" sortMissingLast="true" omitNorms="true">
      <analyzer>
        <!-- KeywordTokenizer does no actual tokenizing, so the entire
             input string is preserved as a single token
          -->
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <!-- The LowerCase TokenFilter does what you expect, which can be
             when you want your sorting to be case insensitive
          -->
        <filter class="solr.LowerCaseFilterFactory" />
        <!-- The TrimFilter removes any leading or trailing whitespace -->
        <filter class="solr.TrimFilterFactory" />

        <filter class="solr.PatternReplaceFilterFactory"
                pattern="([^a-z])" replacement="" replace="all"
        />
      </analyzer>
    </fieldType>

    <fieldtype name="phonetic" stored="false" indexed="true" class="solr.TextField" >
      <analyzer>
        <tokenizer class="solr.StandardTokenizerFactory"/>
        <filter class="solr.DoubleMetaphoneFilterFactory" inject="false"/>
      </analyzer>
    </fieldtype>

    <fieldtype name="payloads" stored="false" indexed="true" class="solr.TextField" >
      <analyzer>
        <tokenizer class="solr.WhitespaceTokenizerFactory"/>
        <!--
        The DelimitedPayloadTokenFilter can put payloads on tokens... for example,
        a token of "foo|1.4"  would be indexed as "foo" with a payload of 1.4f
        Attributes of the DelimitedPayloadTokenFilterFactory : 
         "delimiter" - a one character delimiter. Default is | (pipe)
   "encoder" - how to encode the following value into a playload
      float -> org.apache.lucene.analysis.payloads.FloatEncoder,
      integer -> o.a.l.a.p.IntegerEncoder
      identity -> o.a.l.a.p.IdentityEncoder
            Fully Qualified class name implementing PayloadEncoder, Encoder must have a no arg constructor.
         -->
        <filter class="solr.DelimitedPayloadTokenFilterFactory" encoder="float"/>
      </analyzer>
    </fieldtype>

    <!-- lowercases the entire field value, keeping it as a single token.  -->
    <fieldType name="lowercase" class="solr.TextField" positionIncrementGap="100">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory" />
      </analyzer>
    </fieldType>


    <!-- since fields of this type are by default not stored or indexed,
         any data added to them will be ignored outright.  --> 
    <fieldtype name="ignored" stored="false" indexed="false" multiValued="true" class="solr.StrField" /> 

 </types>


 <fields>
 <!-- Vu fields -->
   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
   <field name="sku" type="string" indexed="true" stored="true" required="false" /> 
   <field name="collection" type="string" indexed="true" stored="true" required="false" /> 
   <field name="title" type="text_fr" required="false" />
   <field name="description" type="text_fr" required="false" />
   <field name="price" type="float" required="false" indexed="true" stored="false" />
   <field name="brand_id" type="text" required="false" />
   <field name="date_online" type="date" required="false" />
   <field name="product_type" type="text" required="false" />   
   <field name="selection_id" type="sint" required="false" multiValued="true" indexed="true" stored="false" />
   <field name="stock_delay" type="sint" required="false"  />
   <field name="stock" type="sint" required="false"  />
   <field name="price_type" type="sint" required="false"  />
   <field name="main_product_id" type="text" required="false"  />
   <field name="date_price" type="date" required="false" />
   <!-- attributes -->
   <dynamicField name="attr_*" type="sint" indexed="true" multiValued="true"/>

   <field name="attr_13" type="int" indexed="true" multiValued="false"/>
   <field name="attr_14" type="int" indexed="true" multiValued="false"/>
   <field name="attr_19" type="int" indexed="true" multiValued="false"/>

    <!-- Ce champ contiendra la copie de tous les autres, pour faciliter la recherche -->
   <field name="global" type="text_fr" required="false" multiValued="true" />


   <!-- Valid attributes for fields:
     name: mandatory - the name for the field
     type: mandatory - the name of a previously defined type from the 
       <types> section
     indexed: true if this field should be indexed (searchable or sortable)
     stored: true if this field should be retrievable
     compressed: [false] if this field should be stored using gzip compression
       (this will only apply if the field type is compressable; among
       the standard field types, only TextField and StrField are)
     multiValued: true if this field may contain multiple values per document
     omitNorms: (expert) set to true to omit the norms associated with
       this field (this disables length normalization and index-time
       boosting for the field, and saves some memory).  Only full-text
       fields or fields that need an index-time boost need norms.
     termVectors: [false] set to true to store the term vector for a
       given field.
       When using MoreLikeThis, fields used for similarity should be
       stored for best performance.
     termPositions: Store position information with the term vector.  
       This will increase storage costs.
     termOffsets: Store offset information with the term vector. This 
       will increase storage costs.
     default: a value that should be used if no value is specified
       when adding a document.
   -->
    <!--
   <field name="id" type="string" indexed="true" stored="true" required="true" /> 
   <field name="sku" type="textTight" indexed="true" stored="true" omitNorms="true"/>
   <field name="name" type="textgen" indexed="true" stored="true"/>
   <field name="alphaNameSort" type="alphaOnlySort" indexed="true" stored="false"/>
   <field name="manu" type="textgen" indexed="true" stored="true" omitNorms="true"/>
   <field name="cat" type="text_ws" indexed="true" stored="true" multiValued="true" omitNorms="true" />
   <field name="features" type="text" indexed="true" stored="true" multiValued="true"/>
   <field name="includes" type="text" indexed="true" stored="true" termVectors="true" termPositions="true" termOffsets="true" />

   <field name="weight" type="float" indexed="true" stored="true"/>
   <field name="price"  type="float" indexed="true" stored="true"/>
   <field name="popularity" type="int" indexed="true" stored="true" />
   <field name="inStock" type="boolean" indexed="true" stored="true" />
    -->

   <!-- Common metadata fields, named specifically to match up with
     SolrCell metadata when parsing rich documents such as Word, PDF.
     Some fields are multiValued only because Tika currently may return
     multiple values for them.
   -->
   <!--
   <field name="title" type="text" indexed="true" stored="true" multiValued="true"/>
   <field name="subject" type="text" indexed="true" stored="true"/>
   <field name="description" type="text" indexed="true" stored="true"/>
   <field name="comments" type="text" indexed="true" stored="true"/>
   <field name="author" type="textgen" indexed="true" stored="true"/>
   <field name="keywords" type="textgen" indexed="true" stored="true"/>
   <field name="category" type="textgen" indexed="true" stored="true"/>
   <field name="content_type" type="string" indexed="true" stored="true" multiValued="true"/>
   <field name="last_modified" type="date" indexed="true" stored="true"/>
   <field name="links" type="string" indexed="true" stored="true" multiValued="true"/>
    -->

   <!-- catchall field, containing all other searchable text fields (implemented
        via copyField further on in this schema  -->
   <!-- <field name="text" type="text" indexed="true" stored="false" multiValued="true"/> -->

   <!-- catchall text field that indexes tokens both normally and in reverse for efficient
        leading wildcard queries. -->
   <!-- <field name="text_rev" type="text_rev" indexed="true" stored="false" multiValued="true"/> -->

   <!-- non-tokenized version of manufacturer to make it easier to sort or group
        results by manufacturer.  copied from "manu" via copyField -->
   <!-- <field name="manu_exact" type="string" indexed="true" stored="false"/> -->

   <!-- <field name="payloads" type="payloads" indexed="true" stored="true"/> -->

   <!-- Uncommenting the following will create a "timestamp" field using
        a default value of "NOW" to indicate when each document was indexed.
     -->
   <!--
   <field name="timestamp" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
     -->


   <!-- Dynamic field definitions.  If a field name is not found, dynamicFields
        will be used if the name matches any of the patterns.
        RESTRICTION: the glob-like pattern in the name attribute must have
        a "*" only at the start or the end.
        EXAMPLE:  name="*_i" will match any field ending in _i (like myid_i, z_i)
        Longer patterns will be matched first.  if equal size patterns
        both match, the first appearing in the schema will be used.  -->
   <!--
   <dynamicField name="*_i"  type="int"    indexed="true"  stored="true"/>
   <dynamicField name="*_s"  type="string"  indexed="true"  stored="true"/>
   <dynamicField name="*_l"  type="long"   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="float"  indexed="true"  stored="true"/>
   <dynamicField name="*_d"  type="double" indexed="true"  stored="true"/>
   <dynamicField name="*_dt" type="date"    indexed="true"  stored="true"/>
    -->

   <!-- some trie-coded dynamic fields for faster range queries -->
   <!--
   <dynamicField name="*_ti" type="tint"    indexed="true"  stored="true"/>
   <dynamicField name="*_tl" type="tlong"   indexed="true"  stored="true"/>
   <dynamicField name="*_tf" type="tfloat"  indexed="true"  stored="true"/>
   <dynamicField name="*_td" type="tdouble" indexed="true"  stored="true"/>
   <dynamicField name="*_tdt" type="tdate"  indexed="true"  stored="true"/>

   <dynamicField name="*_pi"  type="pint"    indexed="true"  stored="true"/>

   <dynamicField name="ignored_*" type="ignored" multiValued="true"/>
   <dynamicField name="attr_*" type="textgen" indexed="true" stored="true" multiValued="true"/>

   <dynamicField name="random_*" type="random" />
    -->
   <!-- uncomment the following to ignore any fields that don't already match an existing 
        field name or dynamic field, rather than reporting them as an error. 
        alternately, change the type="ignored" to some other type e.g. "text" if you want 
        unknown fields indexed and/or stored by default --> 
   <!--dynamicField name="*" type="ignored" multiValued="true" /-->

 </fields>

 <!-- Field to use to determine and enforce document uniqueness. 
      Unless this field is marked with required="false", it will be a required field
   -->
 <uniqueKey>id</uniqueKey>

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

 <!-- SolrQueryParser configuration: defaultOperator="AND|OR" -->
 <solrQueryParser defaultOperator="OR"/>

  <!-- copyField commands copy one field to another at the time a document
        is added to the index.  It's used either to index the same field differently,
        or to add multiple fields to the same field for easier/faster searching.  -->

   <copyField source="title" dest="global"/>
   <copyField source="description" dest="global"/>


</schema>

根据所描述的行为,听起来您正在尝试使用开箱即用的基本 SearchHandler 查询语法来搜索多个字段。这不会像你希望的那样成功。

有多种选项可供选择:

  1. 前端查询,以便发送完全限定的字段名称(例如“fielda:foo OR fieldb:foo”)
  2. 将可搜索字段的内容复制到单个搜索字段(通过 copyField),并将其设置为要搜索的默认字段
  3. 使用Solr Dismax语法并指定多个QueryField(请求中的qf参数)

由于您有不同类型的字段,并且想要应用通配符匹配和其他类似的东西,我建议您采用 Dismax 路线并考虑创建一个更适合您需求的查询处理程序:

更多信息:

  • 默认的搜索处理程序:http://wiki.apache.org/solr/SearchHandler http://wiki.apache.org/solr/SearchHandler
  • Solr 与 Dismax:http://wiki.apache.org/solr/DisMaxQParserPlugin http://wiki.apache.org/solr/DisMaxQParserPlugin
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Solr 不搜索整数? 的相关文章

  • 在 Ecom 应用程序中实施 SOLR 的最佳实践是什么?

    我是 SOLR 的新用户 我正在开发一个具有 SQL 数据库的电子商务 Web 应用程序 我想在应用程序中为我的 类别页面 实现 SOLR 我们将在其中显示该类别的产品以及特定信息 例如可用库存 价格和更多详细信息 此外 我们希望根据库存情
  • 在休眠搜索中使用现有分析器AnalyzerDiscriminator

    Entity Indexed AnalyzerDefs AnalyzerDef name en tokenizer TokenizerDef factory StandardTokenizerFactory class filters To
  • MySQL 错误 1264:列的值超出范围

    As I SETMySQL 中的 cust fax 表如下所示 cust fax integer 10 NOT NULL 然后我插入这样的值 INSERT INTO database values 3172978990 但随后它说 错误 1
  • 过滤掉搜索查询的常用词

    是否有任何简单的方法可以通过提取查询中有意义的数据来实现过滤用户的输入 可能是问题 我基本上想过滤掉任何干扰词 这样我就可以向 Google 的搜索 api 发送 干净 的查询 嗯 谷歌不会为你做这个吗 把所有那些脏话发给谷歌 让他们帮你清
  • Spring MVC 中的 Elasticsearch 集成?

    有谁知道如何集成spring mvc和elasticsearch吗 我想实现一个像一般网站 谷歌 雅虎搜索引擎 一样的网页 有教程或者示例代码吗 查看 Spring Data Elasticsearchproject https githu
  • 常用姓名别名/昵称数据库

    我参与了一个 SQL NET 项目 该项目将搜索名称列表 我正在寻找一种方法来返回类似名字的人的一些结果 如果搜索 Tom 结果将包括 Thom Thomas 等 这是文件还是 Web 服务并不重要 设计示例 Table Names has
  • 如何找到修改文件的最新 git 提交?

    我想找到修改源文件的最新提交 我可以用git blame查看每一行提交的所有日期 但很难准确地看出哪一次提交是最后一次接触文件 如何找到触及 git 存储库中给定文件的最后一次提交 git log https git scm com doc
  • 如何从Azure配置文件获取所有配置设置?

    我需要从 Azure cscfg 文件获取所有配置设置 当前角色或所有角色都无关紧要 我想这样做是因为我不想通过 RoleEnvironment GetConfigurationSettingValue key 方法一一获取所有值 有什么办
  • 使用 dismax 处理程序进行通配符搜索?

    我已成功索引文件 并且希望能够使用通配符进行搜索 我目前正在使用 dismaxRequestHandler QueryType dismax 进行搜索 以便我可以搜索查询的所有字段 像 computer 这样的常规搜索会返回结果 但 com
  • 压缩一组大整数

    我有一组整数 我希望对其有最紧凑的表示 我有以下限制 功能 它被设置 或者换句话说 一个唯一整数的列表 其中顺序并不重要 集合L的大小相对较小 通常为1000个元素 整数遵循 0 到 N 1 之间的均匀分布 其中 N 相对较大 例如 2 3
  • 在 CGI 模式下运行时如何覆盖 PHP 配置

    有一些教程告诉我如何在 CGI 模式下运行时覆盖 PHP 配置 但我仍然很困惑 因为很多人都认为服务器运行在 Linux 上 虽然我需要这样做also在 Windows 上 我的主机确实使用 Linux 但我的本地开发计算机使用 Windo
  • 如何仅将数字形式的字符串哈希值转换为整数

    我有从几个不同的 XML 数据库转储导入的哈希行 如下所示 但具有不同的键 Id gt 1 Name gt Cat Description gt Feline Count gt 123 我尝试使用 to i但它将非数字字符串转换为0 Fel
  • 在代码中创建时 UISearchDisplayController 不工作?

    我正在开发一个选项卡栏应用程序 其中一个选项卡有一个连接到 UISearchBar 的 UISearchDisplayController 所有这些都已连接到 NIB 中并且正在工作 当我点击搜索栏时 范围 和 取消 按钮会飞入等 并且搜索
  • Android:转换为位图时,回收器视图的宽度和高度必须> 0

    在 Sqlite 中存储文本和图像 并尝试将这些数据检索到 recyclerview 中 当将图像显示到 recyclerview 中时 它显示错误宽度和高度必须 gt 0 在将图像保存在 sqlite 中时 我将位图转换为字节 数据库助手
  • 在 R 中使用整数值代替数值(例如 1L 与 1)作为常量的好处

    在 R 源代码中 大多数 但不是全部 函数使用整数值作为常量 colnames lt function x do NULL TRUE prefix col if is data frame x do NULL return names x
  • Solr 阿拉伯语

    我正在使用 Solr 来索引 3 种语言 阿拉伯语 法语和英语 的文档 我使用了这个 fieldType
  • Solr 自定义相似度

    我想在我的 solr schema xml 中设置我自己的自定义相似度 但我在理解此功能时遇到一些问题 我想完全停用 solr 评分 tf idf coord 和 fieldNorm 我不知道从哪里开始 我知道的事情 我必须编写自己的 De
  • 在 VS Code 文件搜索中,我可以展开(或折叠)所有结果吗?

    在程序的 搜索 窗格中 按 Enter 键后 会列出所有文件 其中一些文件会展开以显示文件中的结果 而其他文件则会折叠 我首先想知道是什么决定了任何给定文件的扩展 其次我想知道如何一次性扩展所有文件 这个问题似乎最接近我的问题 但它是关于不
  • 如何在 sunspot solr 中进行简单的布尔查询

    gt gt gt marketing User search do s gt gt gt s fulltext Marketing gt gt gt end gt gt gt marketing total 1448 gt gt gt sa
  • 不指定字段名查询Solr

    我是 Solr 的新手 我一定错过了一些东西 我在示例模式中还没有接触太多 我导入了一些示例数据 我也设置了LocalSolr 这似乎运作良好 我的问题只是查询Solr一般来说 我有一份文件 其中name字段设置为tom 我一直在查看配置文

随机推荐

  • 简单 CAE 的问题

    看起来简单的 CAE 不适用于 Carvana 数据集 我正在尝试对 Carvana 数据集进行简单的 CAE 你可以下载它here https www kaggle com c carvana image masking challeng
  • 如何知道 PHP require_once() 语句中使用的正确路径

    正如许多人一样 我在 Web 应用程序的根目录中有一个 config php 文件 我想将其包含在几乎所有其他 php 文件中 所以他们中的大多数都有这样的一行 require once config php 或有时 require onc
  • 如何在 boost::python 嵌入式 python 代码中导入模块?

    我正在使用 boost python 将一些 python 代码嵌入到应用程序中 我能够正确评估打印语句或其他表达式 但是当我尝试导入模块时 它没有导入并且应用程序正在退出 此外 嵌入代码中的 globals 函数调用也会产生运行时错误 i
  • 如何从 Azure Web 应用程序中删除过多的响应标头信息?

    我有一个部署在 Azure Web 应用上的 MVC 项目 我正在尝试删除过多的标头信息 我尝试删除此信息的原因是因为这是标准的安全实践 参考 http www troyhunt com 2012 02 shhh dont let your
  • 背景大小:封面在 Google Chrome 中突然停止工作?

    还有其他人有这个问题吗 我以创建网站为生 有些网站使用了 css 属性background size cover 大约 1 周前突然间 所有具有此属性的网站都不再在 Google Chrome 中正确显示 所有其他浏览器都工作正常 还有其他
  • 什么是“非阻塞”并发?它与普通并发有何不同?

    什么是 非阻塞 并发 它与使用线程的普通并发有何不同 为什么不在所有需要并发的场景中都使用非阻塞并发呢 使用非阻塞并发有开销吗 我听说Java中可以实现非阻塞并发 我们是否应该在特定场景下使用此功能 将这些方法之一与集合一起使用是否有区别或
  • 安装时反应 spring 错误

    你好 我有这个问题 如果我想将react spring安装到我的react项目中 它只会弹出一堆依赖项错误和警告 我不知道该怎么办 我试图检查react spring的文档 但找不到任何东西 我在 stackoverflow 上检查了几页
  • 通过 HTML 将复杂变量传递给 javascript 的正确方法

    我试图摆脱使用 PHP 的 htmlentities 但我在这里停止了 但后来我想 我不做替换和检查特殊字符 而是只 JSON 整个对象 这提供了一个非常不受欢迎的结果 其中包含大量双引号 那么我应该怎么做呢 我应该为每个图像分配一个数字唯
  • Maven:无法在 OS X 上找到 java.lang 问题

    当我尝试时遇到以下问题mvn clean install显然它无法找到运行时 jar 但我需要做什么 错误日志 ERROR COMPILATION ERROR INFO ERROR Failure executing javac but c
  • Unity 中图像的 onClick 事件

    是否可以在 Unity 中将 onClick 功能添加到图像 画布的组件 var obj new GameObject Image NewImage obj AddComponent
  • 如何检查 API 级别 23 下的权限? [复制]

    这个问题在这里已经有答案了 我的一个应用程序有权限RECORD AUDIO和我的应用程序targetSdkVersion是 22 我无法在运行时检查权限 但我注意到如果我在 Android 6 0 及更高版本中安装我的应用程序 用户可以在系
  • 反序列化时出现 Gson 异常(无参数构造函数不存在)

    我遇到了一个问题 该问题仅在 5000 台设备中的 10 台中出现 无法用我的模拟器和测试设备重现它 这似乎是一个非常具体的问题 仅涉及少数设备 我所拥有的只是堆栈跟踪和我的代码 因此 我正在针对黑洞进行开发 只有在 GooglePlay
  • Firebase 实时数据库 .info/connected 本应为 True 时为 False

    我有一个 Android 服务 它的调用地址为onCreate FirebaseDatabase database FirebaseDatabase getInstance database getReference info connec
  • 如何制作具有两个索引的 Map?

    我在java中有一张这样的地图 Map
  • 重新创建窗口而不破坏上下文

    这个问题是关于使用 OpenGL 的图形应用程序 当时我正在使用 GLFW 框架 但我考虑更改它 我的目标是让用户 尽可能 在全屏模式和窗口模式之间不断切换 此过程应该花费不到一秒的时间 并且可以在运行时发生 例如 看看游戏 我的世界 用户
  • 使用 JWT 创建 Firebase 自定义身份验证令牌

    为了创建 firebase 自定义身份验证令牌 我使用第三方 JWT 库 https github com jwtk jjwt https github com jwtk jjwt 在此库中 有一个选项可以添加 firebase 自定义令牌
  • 如何为谷歌材料条形图制作动画

    我正在反应项目中绘制反应谷歌条形图 材料图表 并且我正在尝试制作动画 我读过这种图表不支持动画 但我需要这样做 必须有任何方法可以做到这一点 我很难认为新的东西比旧的东西更糟糕 有人知道我该怎么做吗 我尝试了很多不同的方法 但没有任何效果
  • 从 mx:Image 复制位图数据

    如何从 mx image 组件复制位图数据 我需要在应用程序的多个屏幕中显示相同的图像 并且不想多次下载该图像 我可以只使用 urlrequest 将图像下载为位图并复制它 但我喜欢只设置图像组件的源的方式 Image延伸SWFLoader
  • 如何为Spring Boot中的所有控制器指定前缀?

    我有控制器映射到 user and order RestController RequestMapping users public class UserController RestController RequestMapping or
  • Solr 不搜索整数?

    我目前正在使用 Solr 为电子商务网站开发搜索引擎 所以我在 schema xml 中得到这两个字段