What is Indexing and search full_text arabic field using apache solr ?

Answer:Apache Solr has an Arabic analysis.

Arabic field using apache solr:

  • Apache Solr has an Arabic analysis.
  • If you open the default schema.xml file which comes with Solr, you will see an example of Arabic fieldtype.
  • You can use CopyField to copy your fields to the Arabic field type.
  • You have to reindex your content again to get the preferred results.
  • If each document consists of 3 fields, two fields are integers then the third field is Arabic text with diacritics, the user may use words with or without diacritics or else some letters have diacritics and others without diacritics, you can use schema.xml which helps in such situation.
<?xml version="1.0" encoding="UTF-8" ?>

<schema name="quran" version="1.5">

<field name="_version_" type="long" indexed="true" stored="true"/>
<field name="_id" type="long" indexed="true" stored="true" />
<field name="sura_number" type="int" indexed="true" stored="true" />
<field name="verse_number" type="int" indexed="true" stored="true" />
<field name="verse_text" type="text_ar" indexed="true" stored="true"/>

<fieldType name="string" class="solr.StrField" sortMissingLast="true" />
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>

<fieldType name="int" class="solr.TrieIntField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="float" class="solr.TrieFloatField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
<fieldType name="double" class="solr.TrieDoubleField" precisionStep="0" positionIncrementGap="0"/>

<fieldType name="date" class="solr.TrieDateField" precisionStep="0" positionIncrementGap="0"/>

<fieldType name="location" class="solr.LatLonType" subFieldSuffix="_coordinate"/>
<dynamicField name="*_coordinate" type="tdouble" indexed="true" stored="false"/>

<!-- Arabic -->
<fieldType name="text_ar" class="solr.TextField" positionIncrementGap="100">
<tokenizer class="solr.StandardTokenizerFactory"/>
<!-- normalizes ﻯ to ﻱ, etc -->
<filter class="solr.ArabicNormalizationFilterFactory"/>
<filter class="solr.ArabicStemFilterFactory"/>


Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like