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>