08-07-14, 05:43 PM
السلام عليكم
رمضان مبارك سعيد ..
كما هو واضح من العنوان .. البحث عن كلمات متشابهة في جدول لقاعدة بيانات
مثلا لدينا
جدول من ثلاث خانات
الرقم و الإسم الشخصي و الإسم العائلي
و أريد البحث عن كلمة "عبد الرحمن" و الأهم أنها بالعربي
في النتيجة ..
أريد أن تظهر عبد الرحمان و عبدالرحمن
أو مثلا رقية و ارقية
....
طبعا قمت بعملية بحث فوجدت عدة دوال ك Soundex
إلا أنها على ما أعتقد غير موجوده في Access
ثم أنها لا تدعم العربية
...
ثم وجدت هدا الكود
من هنا
لكن كيف يمكنني إستخدامها للبحث في قاعدة البيانات Access ؟
شكرا لكم مسبقا ...
رمضان مبارك سعيد ..
كما هو واضح من العنوان .. البحث عن كلمات متشابهة في جدول لقاعدة بيانات
مثلا لدينا
جدول من ثلاث خانات
الرقم و الإسم الشخصي و الإسم العائلي
و أريد البحث عن كلمة "عبد الرحمن" و الأهم أنها بالعربي
في النتيجة ..
أريد أن تظهر عبد الرحمان و عبدالرحمن
أو مثلا رقية و ارقية
....
طبعا قمت بعملية بحث فوجدت عدة دوال ك Soundex
إلا أنها على ما أعتقد غير موجوده في Access
ثم أنها لا تدعم العربية
...
ثم وجدت هدا الكود
PHP كود :
public static string ArComputeintial(string word, int length)
{
// Value to return
string value = "";
switch (word[0])
{
case 'ا':
case 'أ':
case 'إ':
case 'آ':
{
word = word.Substring(1, word.Length - 1);
}
break;
}
// Size of the word to process
int size = word.Length;
// Make sure the word is at least two characters in length
if (size > 1)
{
// Convert the word to character array for faster processing
char[] chars = word.ToCharArray();
// Buffer to build up with character codes
StringBuilder buffer = new StringBuilder();
buffer.Length = 0;
// The current and previous character codes
int prevCode = 0;
int currCode = 0;
// Ignore first character and replace it with fixed value
buffer.Append('x');
// Loop through all the characters and convert them to the proper character code
for (int i = 1; i < size; i++)
{
switch (chars[i])
{
case 'ا':
case 'أ':
case 'إ':
case 'آ':
case 'ح':
case 'خ':
case 'ه':
case 'ع':
case 'غ':
case 'ش':
case 'و':
case 'ي':
currCode = 0;
break;
case 'ف':
case 'ب':
currCode = 1;
break;
case 'ج':
case 'ز':
case 'س':
case 'ص':
case 'ظ':
case 'ق':
case 'ك':
currCode = 2;
break;
case 'ت':
case 'ث':
case 'د':
case 'ذ':
case 'ض':
case 'ط':
currCode = 3;
break;
case 'ل':
currCode = 4;
break;
case 'م':
case 'ن':
currCode = 5;
break;
case 'ر':
currCode = 6;
break;
}
// Check to see if the current code is the same as the last one
if (currCode != prevCode)
{
// Check to see if the current code is 0 (a vowel); do not process vowels
if (currCode != 0)
buffer.Append(currCode);
}
// Set the new previous character code
prevCode = currCode;
// If the buffer size meets the length limit, then exit the loop
if (buffer.Length == length)
break;
}
// Pad the buffer, if required
size = buffer.Length;
if (size < length)
buffer.Append('0', (length - size));
// Set the value to return
value = buffer.ToString();
}
// Return the value
return value;
}
لكن كيف يمكنني إستخدامها للبحث في قاعدة البيانات Access ؟
شكرا لكم مسبقا ...
منقطع .. للدراسة