0

I wan't to search for certain numbers in my index but I'm having trouble with certain results. (I'm using edismax.)

Example:

    Term in index  I want to search: b1.123.456
    Query I use is b1 123 456 (no spaces)

This doesn't work because a . is not the same as a - (I've read the documentation) I looked for a solution and found that I have to use a Filter on my field:

<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
  <analyzer type="index">
    <charFilter  class="solr.MappingCharFilterFactory" mapping="mapchar.txt" />
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
  <analyzer type="query">
    <charFilter  class="solr.MappingCharFilterFactory" mapping="mapchar.txt" />
    <tokenizer class="solr.StandardTokenizerFactory"/>
    <filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" enablePositionIncrements="true" />
    <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
    <filter class="solr.LowerCaseFilterFactory"/>
  </analyzer>
</fieldType>

This is my fieldtype, the mapchar contains "."=>" "

Now when I try to search:

    b1.123.456   returns all results for each token (normal behaviour)
    "b1.123.456" returns what I'm looking for.
    "b1 123 456" returns what I'm looking for.
     b1 123 456  **returns nothing**

Why does a normal edismax query without phrase search return 0 results?

Edit:

I've found an error in the logs when I use the last query:

<record>
  <date>2012</date>
  <millis></millis>
  <sequence></sequence>
  <logger>org.apache.solr.servlet.SolrDispatchFilter</logger>
  <level>SEVERE</level>
  <class>org.apache.solr.common.SolrException</class>
  <method>log</method>
  <thread>12</thread>
  <message>null:java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at org.apache.solr.util.SolrPluginUtils.calculateMinShouldMatch(SolrPluginUtils.java:563)
    at org.apache.solr.util.SolrPluginUtils.setMinShouldMatch(SolrPluginUtils.java:518)
    at org.apache.solr.search.ExtendedDismaxQParser.parse(ExtendedDismaxQParserPlugin.java:264)
    at org.apache.solr.search.QParser.getQuery(QParser.java:143)
    at org.apache.solr.handler.component.QueryComponent.prepare(QueryComponent.java:118)
    at org.apache.solr.handler.component.SearchHandler.handleRequestBody(SearchHandler.java:185)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1699)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:455)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:276)
    at ...
</message>
</record>
4

1 回答 1

0

由于默认查询处理程序有效(/select),我开始认为我的查询处理程序有问题。

为了找出问题所在,我开始稍微禁用我自己的请求处理程序的一部分。

  <!--<str name="mm"></str>-->

一个空的mm会给你错误

我曾经有一个 mm 参数,但我真的不再需要它了,所以我把它留空了......

于 2012-12-27T15:23:10.300 回答