Solr的查询解析器的Lucene索引?

| 我已经创建了一个索引(使用Lucene 2.9)来存储文本消息。 (文档还包含一些其他未索引的元数据,只是存储了)我使用StandardAnalyzer解析这些消息。我正在尝试使用Solr在该索引上运行一些测试(我将示例应用程序索引替换为索引),以查看从各种查询中获得的结果。 当我尝试以下查询时,我得到0个结果
\"text:happiness\"
但是,将其更改为“ 1”会给我一些结果。它们都包含诸如
\"happiness,\", \"happiness.\"
之类的术语。因此,我认为这是索引创建期间的令牌化问题,但是,当我使用Luke(Lucene索引调试工具)运行相同的查询
(text:happiness)
时,得到的结果与我完全相同从Solr获得幸福*,这使我相信问题不在索引时,而是在指定Solr查询时。我查看了solrconfig.xml,发现它具有以下行(有注释),我尝试对其取消注释,然后除了原始查询之外,还修改了查询以使用\“ defType = lucene \”,但是得到了相同的结果。结果。
  <queryParser name=\"lucene\" class=\"org.apache.solr.search.LuceneQParserPlugin\"/>
我对Solr的经验很少,因此非常感谢您的帮助:)     
已邀请:
我正在查询的字段在solr schema.xml中定义为类型\“ text \”(不是我在前面的注释中错误提到的solrconfig.xml)。这是来自schema.xml的相关片段
<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.
        -->
我将其替换为以下内容,
<fieldType name = \"text\" class=\"solr.TextField\">
      <analyzer class=\"org.apache.lucene.analysis.standard.StandardAnalyzer\"/>
    </fieldType>
这给了我所需的行为。     

要回复问题请先登录注册