0

I have schema.xml like this:

Sample data

id          Country    State     City       Area
1            India      abc       cd        mnv 
15131        India      Delhi     HauzK     asdf (from 1 to 15131 inserted usingcsvhandler) 
15132         India      Karnatka  Bang     mno  ( 15132 inserted using solarium api)

All fields are text_general type and applying

  1. Whitespace tokenizer
  2. Lowercase filterfactory
  3. Ngramfilter factory

One thing to note : I inserted records from Id = '1' to id=15131 with CSV request handler and document with id = 15132 using solarium API to insert new record.

Now, I have suggestion box for country. I want to show only different countries, so I did group by on country.

http://localhost:8983/solr/searchLocation/country?    
q=country%3Ain&wt=xml&indent=true&group=true&group.field=country

I got following result

    <response>
    <lst name="responseHeader">
      <int name="status">0</int>
      <int name="QTime">4</int>
    </lst>
    <lst name="grouped">
    <lst name="country">
    <int name="matches">15132</int>
    <arr name="groups">
    <lst> 
    **<str name="groupValue">ndia</str>**
    <result name="doclist" numFound="15131" start="0" maxScore="0.24998347">
    <doc>
    <str name="country">india</str>
    <str name="state">Andaman and Nicobar</str>
    <str name="city">A&N Islands</str>
    <str name="area">Marine Jetty</str>
    <str name="id">02cb8ba4-bffe-4c4e-a976-29f01ad8d275</str>
    <float name="score">0.24998347</float>
    </doc>
    </result> 
   </lst>
    <lst>
    **<str name="groupValue">d</str>**
   <result name="doclist" numFound="1" start="0" maxScore="0.24998347">
   <doc>
    <str name="country">india</str>
    <str name="state">Kerala</str>
    <str name="city">Palghat</str>
    <str name="area">Padagirinew</str>
    <str name="id">0158f635-24dd-4d2f-9697-e79272684c95</str>
    <float name="score">0.24998347</float>
   </doc>
    </result>
    </lst>
    </arr>
    </lst>
    </lst> 
    </response>
  • My confusion is , how it could be possible I got two groups
    1. all records from id = 1 to id=15131 with country value = india
    2. last record with id = 15132 with country value = india

Why it is not making two different groups?? It should be single group becuase value of country field is India ...

Thanks

voila
  • 1,594
  • 2
  • 19
  • 38
  • Why ??? But I want let user search on substrings also .. – voila Apr 15 '13 at 19:26
  • If it is the problem with ngram, then why documents from 1 to 15131 are plunge into one group and only document with id 15132 is falling in another grop – voila Apr 15 '13 at 19:27

0 Answers0