0

I have used solr4.7 and I have multiple record in DB , I have search successfully for case sensitive data that is lowercase.

I have lots of try to solve this , I am very tired,

my one of the code is schema.xml file code as below

<schema name="springExample" version="1.5">
<fields>
    <field name="name" type="text_general" indexed="true" stored="true" required="true" />
</fields>
<types>
        <fieldType name="text_general" class="solr.TextField" positionIncrementGap="100">

            <analyzer type="index">
                <tokenizer class="solr.WhitespaceTokenizerFactory" />
                <filter class="solr.LowerCaseFilterFactory" />
            </analyzer>
            <analyzer type="query">
                <tokenizer class="solr.WhitespaceTokenizerFactory" />
                <filter class="solr.LowerCaseFilterFactory" />
            </analyzer>
     </fieldType>
</types>

and also configure the config.xml file for dataSource and document.

<dataConfig>
    <dataSource driver="com.mysql.jdbc.Driver"
        url="jdbc:mysql://localhost:3306/koupon"
        user="root"
        password="root" />
    <document>
        <entity name="koupon" 
            query="SELECT name FROM koupon;">
                <field column="name" name="name"/>
        </entity>
    </document>
</dataConfig>

and java code for Fetching Specific data like that

solrParams = new ModifiableSolrParams();
solrParams.add("q","name:TE*");
solrParams.add("wt","json");
solrParams.add("indent","true");
queryResponse = server.query(solrParams);
solrParams.clear();

System.out.println(queryResponse.getResults());

and I am searching for 'name' field like 

Testing Category,Testing, TEst.

How can I solve this?

user2428568
  • 223
  • 1
  • 4
  • 18
  • Can you share the part of your schema file where you've defined your field category? I only see a field **name** in your schema, but you are searching on the field **category**. Make sure your **category** field is also of type **text_general**, this may explain why you don't see any change in results when modifying your fieldType **text_general**. – Denis Apr 11 '14 at 08:58
  • solr case sensitive is running now but WhitespaceTokenizerFactory are not working – user2428568 Apr 18 '14 at 07:25
  • possible duplicate of [SOLR Case Insensitive Search](http://stackoverflow.com/questions/8240329/solr-case-insensitive-search) – hcarrasko Apr 30 '14 at 14:35

2 Answers2

0

My configuration in my schema.xml is this:

<fieldType name="text_wslc" class="solr.TextField" positionIncrementGap="100">
      <analyzer type="index">
         <tokenizer class="solr.WhitespaceTokenizerFactory"/>
         <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
         <analyzer type="query">
              <tokenizer class="solr.WhitespaceTokenizerFactory"/>
              <filter class="solr.LowerCaseFilterFactory"/>
          </analyzer>
</fieldType>

And accept uppercase and lowercase, please try deleting the others tags.

NOTE: Remember restart your solr to apply the changes Hope it helps :)

hcarrasko
  • 2,320
  • 6
  • 33
  • 45
0

Try setting minGramSize=2 in attributes of EdgeNGramFilterFactory, remove asterisk from the query: solrParams.add("q","category:te");, restart Solr and reindex records.

kulesa
  • 2,964
  • 20
  • 11