Search code examples
solr

How to fetch records from solr those having spaces


I have solr collection and stored a million documents inside. Name is one field in that document holding values along with multiple spaces (Dont know exactly space count). Need to gives name and ids for those records.

For Ex:1. Name: "Arun " 2. Name: "David " 3. Name: "Rahul" (correct record not require ID for this)

Please let me the fq.

Added Field details

<field name="CallSign"  type="text_general"    indexed="true"  stored="true"/>

Adding token details for field CallSign.

Field: CallSign
Field-Type:org.apache.solr.schema.TextFieldPI Gap:100Docs:20,719
Flags:  Indexed Tokenized   Stored  UnInvertible    Omit Norms
Properties  √   √   √   √   √
Schema  √   √   √   √   √
Index Analyzer:
org.apache.solr.analysis.TokenizerChain
Query Analyzer:
org.apache.solr.analysis.TokenizerChain
  

Solution

  • I found solution for my question. Lets consider field is Name

    q=Name:*\s*
    

    By using the above solr query it is fetching all documents whose names have space/spaces only.

    Thank you all for you inputs.