I am trying to search Solr Instance with Solr.Net. I have field body
which is defined in schema as:
<field name="body"
type="text_general"
indexed="true"
stored="true"
omitNorms="true"/>
text_general
uses solr.StandardTokenizerFactory
in schema and defined as:
<fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<!-- in this example, we will only use synonyms at query time
<filter class="solr.SynonymFilterFactory" synonyms="index_synonyms.txt" ignoreCase="true" expand="false"/>
-->
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords.txt" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>
(I haven't changed anything with this field type, It is the one I got with the default installation of solr)
I am trying to query records against search term LISTBU5.RCV
, it is returning me results containing LISTBU4.RCV
. Like:
Items left on queue: \\111.11.11.11\Lists\SAVELIST\ABC2\LISTBU4.RCV
False Result: The number at the end of the search term is different
My code for querying is:
SolrQueryByField solrQuery = new SolrQueryByField("body", searchTerm);
var result = solr.Query(solrQuery, new SolrNet.Commands.Parameters.QueryOptions
{
Rows = 100, //
Start = 0,
OrderBy = new[] { new SortOrder("ID", Order.DESC) },
});
But if I use Text Query like:
SolrQuery solrQuery = new SolrQuery("(body:" + "\"" + searchTerm + "\")");
It returns exact results. I know that creating a Text query is not encouraged in Solr.Net
but what should I do about it ?
I am using SolrNet.dll
version 0.4.0.2002
with Solr Instance 4.4.0
version.