*New 12.2 series Release:
2021-11-21: XigmaNAS 12.2.0.4.8860- released!

We really need "Your" help on XigmaNAS Language packages. Please help us today!

XigmaNAS talks on IRC https://web.libera.chat/#xigmanas, ircs://irc.libera.chat:6697 (TLS) or irc://irc.libera.chat:6667 (plain text)

[HOWTO] File Indexing Service

Only Admin's or Moderators can move thread's to this sub-forum.
Nobody should start a new thread on this sub-forum.
Anybody can reply to a thread on this sub-forum.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
Hiji56
Advanced User
Advanced User
Posts: 170
Joined: Feb 13th, '21, 11:33
Status: Offline

[HOWTO] File Indexing Service

#1

Post by Hiji56 »

"
by raulfg3»17 Jul 2012 12:24
Copied from Old FreeNAS Forum by danmero » Fri Jan 22, 2010 12:28 am ""http://sourceforge.net/apps/phpbb/freen ... 45b5d9c410""
FreeNAS 0.7RC2 (revision 4888) i386-embedded; IBM CDTPWSPI Intel Pentium III 511MiB RAM
Used space total 1818GB
Code: Select all

Code: Select all

$ time find /mnt/ -type f > index.txt
real    0m12.758s
user    0m0.780s
sys     0m7.071s
$ wc -l index.txt
  127533 index.txt
$ time grep  ""en/index.txt""   index.txt
/mnt/temp/.www/wiki.back/data/pages/sug/en/index.txt
/mnt/temp/.www/wiki.back/inc/lang/en/index.txt
/mnt/temp/.www/wiki/data/pages/sug/en/index.txt
/mnt/temp/.www/wiki/inc/lang/en/index.txt
real    0m0.292s
user    0m0.067s
sys     0m0.170s
Should work and use only built-in FreeNAS utility
"
"
Copied from Old FreeNAS Forum by danmero » Fri Jan 22, 2010 12:28 am ""http://sourceforge.net/apps/phpbb/freen ... 45b5d9c410""
FreeNAS 0.7RC2 (revision 4888) i386-embedded; IBM CDTPWSPI Intel Pentium III 511MiB RAM
Used space total 1818GB
Code: Select all

Code: Select all

$ time find /mnt/ -type f > index.txt
real    0m12.758s
user    0m0.780s
sys     0m7.071s
$ wc -l index.txt
  127533 index.txt
$ time grep  ""en/index.txt""   index.txt
/mnt/temp/.www/wiki.back/data/pages/sug/en/index.txt
/mnt/temp/.www/wiki.back/inc/lang/en/index.txt
/mnt/temp/.www/wiki/data/pages/sug/en/index.txt
/mnt/temp/.www/wiki/inc/lang/en/index.txt
real    0m0.292s
user    0m0.067s
sys     0m0.170s
Should work and use only built-in FreeNAS utility
"
"
by raulfg3»17 Jul 2012 12:25
by alexey123 » Sun Oct 23, 2011 10:37 pm
May be anybody need my search method
I have 6 comps ( 4 windows + 2 Ubuntu ) on my local network + Freenas server as fileserver. Because my search method need web interface for access from all mashines.
Current version is Google Desktop plus Goolag, running on windows mashine
""https://docs.google.com/document/pub?id ... cjWWEce7JI"" Working fine!
I was make also only for test Xapian-omega search on FreeBSD virtual mashine,
How to
Also working, but i not want to run virtualmashine 24/7
My question is : Anybody know how to add xapian-omega to Freenas ?
"
"
by alexey123 » Sun Oct 23, 2011 10:37 pm
May be anybody need my search method
I have 6 comps ( 4 windows + 2 Ubuntu ) on my local network + Freenas server as fileserver. Because my search method need web interface for access from all mashines.
Current version is Google Desktop plus Goolag, running on windows mashine
""https://docs.google.com/document/pub?id ... cjWWEce7JI"" Working fine!
I was make also only for test Xapian-omega search on FreeBSD virtual mashine,
How to
Also working, but i not want to run virtualmashine 24/7
My question is : Anybody know how to add xapian-omega to Freenas ?
"
"
by raulfg3»17 Jul 2012 12:29
by alexey123 » Fri Oct 28, 2011 9:01 pm
May be How to
Install ""http://www.searchtools.com/tools/xapian.html"" on FreeNAS server.
I was test it on Freenas - 0.7.5 TEST ONLY (revision 9S-8375), but I’m sure any older version of FreeNAS will do work perfectly.
UPDATE: tested on 0.7.2 Sabanda (revision 5543) - worked, just need call packages from ftp archive
AMD64
Code: Select all

Code: Select all

setenv PACKAGESITE ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-7.3-release/Latest/
i386
Code: Select all

Code: Select all

setenv PACKAGESITE ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-7.3-release/Latest/
Maybe I did something wrong that, because I am not a programmer and beginner on Freebsd. Now I use Google Desktop to search for files on the server Freenas with hack-tool goolag, but this configuration has one gripe - Windows host.
Code: Select all

Code: Select all

# pkg_add -r xapian-omega
# pkg_add -r xpdf
# pkg_add -r catdoc
# pkg_add -r unzip
# pkg_add -r gzip
# pkg_add -r antiword
# pkg_add -r unrtf
# pkg_add -r catdvi
Ok, minimum packages installed. In this step I need make holding directories for xapian-omega will work. I have data-partition on system disk, called as “data”.
Code: Select all

Code: Select all

# mkdir -p /mnt/data/omega/data
# mkdir -p /mnt/data/omega/cdb
# mkdir -p /mnt/data/omega/download
# mkdir -p /mnt/data/omega/www
# mkdir -p /mnt/data/omega/log
Directory download need for extract templates for omega from source. From FreeNAS web interface System > Packages find xapian-omega version. I have xapian-omega-1.0.22. Sources for it
UPDATE: For 0.7.2 Sabanda (revision 5543) need source xapian-omega-1.0.18
#Code: Select all

Code: Select all

 cd /mnt/data/omega/download
# fetch http://oligarchy.co.uk/xapian/<version-number>/xapian-omega-<version number>.tar.gz
# tar xzvf xapian-omega-<version number>.tar.gz
With QuiXplorer (Freenas file manager) copy directories with content
/mnt/data/download/xapian-omega-<version number>/templates to /mnt/data/omega/
/usr/local/www/xapian-omega/cgi-bin to /mnt/data/www/
Tell Xapian-Omega where to look for the files.
Create the file with QuiXplorer /mnt/data/www/cgi-bin/omega.conf
content
# Directory containing Xapian databases:
database_dir /mnt/data/omega/data
# Directory containing omega script templates:
template_dir /mnt/data/omega/www/templates
# Directory to write Omega logs to:
log_dir /mnt/data/omega/log
# Directory containing any cdb files for the $lookup OmegaScript command:
cdb_dir /mnt/data/omega/cdb
Prepare lighttpd webserver for Omega. Edit configuration file /etc/rc.d/websrv with freenas web ui in tab Advansed > File editor
Add modules mod_cgi and mod_alias in server modules.
server.modules = (
mod_rewrite,
mod_redirect,
mod_access,
mod_auth,
mod_cgi,
""mod_alias"" )

url.access-deny = ( ""~"", "".inc"", "".websrv_htpasswd"" )
static-file.exclude-extensions = ( "".php"", "".pl"", "".fcgi"" )
server.pid-file = ""${pidfile}""
alias.url = ( ""/cgi-bin/"" => ""/mnt/data/omega/www/cgi-bin/"" )
alias.url += ( ""/data/"" => ""/mnt/data/"" )
cgi.assign = ( "".php"" => ""/usr/local/bin/php"",
"".cgi"" => ""/usr/bin/perl"",
.pl => ""/usr/bin/perl"",
.rb => ""/usr/bin/ruby"",
.crest => ""/usr / bin / eruby"",
.py => ""/usr / bin / python"",
.am => """",
omega => """")
# include rewrite rule for main config file
include ""/etc/rc.d/webserv.inc.conf""
Green color mark added lines
Create a search page. I’ll just use /mnt/data/omega/www/xap.html
Code: Select all

Code: Select all

<html><head>
<title>Intranet Search</title>
</head>
<body bgcolor=""#ffffff"">
<FORM NAME=P METHOD=GET
ACTION=""/cgi-bin/omega"" TARGET=""_top"">
<center>
<INPUT NAME=P VALUE="""" SIZE=65>
<INPUT TYPE=SUBMIT VALUE=""Search"">
<hr>
<INPUT TYPE=radio NAME=DEFAULTOP VALUE=or > Match any word
<INPUT TYPE=radio NAME=DEFAULTOP VALUE=and CHECKED> Match all words
</center><br>
<INPUT TYPE=hidden NAME=DB VALUE=""default"">
<INPUT TYPE=hidden NAME=FMT VALUE=""query"">
<INPUT TYPE=hidden NAME=xDB VALUE=""default"">
<INPUT TYPE=hidden NAME=xFILTERS VALUE=""--O"">
</FORM>
<hr>
</body></html>
Make symbolic link 
Code: Select all

Code: Select all

ln -s /mnt/data/omega/templates /mnt/data/omega/www/templates
Document root for freenas web server must be set to /mnt/data/www/ Save and restart web server for test configuration file.
Reboot Freenas now
Next step - try by hand make index for download folder. I was add files, downloaded from sources and extracted into download folder. Only for test..
Code: Select all

Code: Select all

/usr/local/bin/omindex --db /mnt/data/omega/data/default --url /data /mnt/data --depth-limit=0
Wait for ending
Now fire up your browser and validate the result by surfing over to the IP address of the server. If that worked out well too, the last steps is
1. remove /mnt/data/omega/download
2. remove /mnt/data/omega/data/default
3 correct omindex arguments for really shared folders.
4 try by hand index and search files and add omindex to crontab, so that it refreshes the index automatically. In my case, once a week is enough.
ENJOY!!
I will continue to adapt the search For Freenas
"
"
by alexey123 » Fri Oct 28, 2011 9:01 pm
May be How to
Install ""http://www.searchtools.com/tools/xapian.html"" on FreeNAS server.
I was test it on Freenas - 0.7.5 TEST ONLY (revision 9S-8375), but I’m sure any older version of FreeNAS will do work perfectly.
UPDATE: tested on 0.7.2 Sabanda (revision 5543) - worked, just need call packages from ftp archive
AMD64
Code: Select all

Code: Select all

setenv PACKAGESITE ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/amd64/packages-7.3-release/Latest/
i386
Code: Select all

Code: Select all

setenv PACKAGESITE ftp://ftp-archive.freebsd.org/pub/FreeBSD-Archive/ports/i386/packages-7.3-release/Latest/
Maybe I did something wrong that, because I am not a programmer and beginner on Freebsd. Now I use Google Desktop to search for files on the server Freenas with hack-tool goolag, but this configuration has one gripe - Windows host.
Code: Select all

Code: Select all

# pkg_add -r xapian-omega
# pkg_add -r xpdf
# pkg_add -r catdoc
# pkg_add -r unzip
# pkg_add -r gzip
# pkg_add -r antiword
# pkg_add -r unrtf
# pkg_add -r catdvi
Ok, minimum packages installed. In this step I need make holding directories for xapian-omega will work. I have data-partition on system disk, called as “data”.
Code: Select all

Code: Select all

# mkdir -p /mnt/data/omega/data
# mkdir -p /mnt/data/omega/cdb
# mkdir -p /mnt/data/omega/download
# mkdir -p /mnt/data/omega/www
# mkdir -p /mnt/data/omega/log
Directory download need for extract templates for omega from source. From FreeNAS web interface System > Packages find xapian-omega version. I have xapian-omega-1.0.22. Sources for it
UPDATE: For 0.7.2 Sabanda (revision 5543) need source xapian-omega-1.0.18
#Code: Select all

Code: Select all

 cd /mnt/data/omega/download
# fetch http://oligarchy.co.uk/xapian/<version-number>/xapian-omega-<version number>.tar.gz
# tar xzvf xapian-omega-<version number>.tar.gz
With QuiXplorer (Freenas file manager) copy directories with content
/mnt/data/download/xapian-omega-<version number>/templates to /mnt/data/omega/
/usr/local/www/xapian-omega/cgi-bin to /mnt/data/www/
Tell Xapian-Omega where to look for the files.
Create the file with QuiXplorer /mnt/data/www/cgi-bin/omega.conf
content
# Directory containing Xapian databases:
database_dir /mnt/data/omega/data
# Directory containing omega script templates:
template_dir /mnt/data/omega/www/templates
# Directory to write Omega logs to:
log_dir /mnt/data/omega/log
# Directory containing any cdb files for the $lookup OmegaScript command:
cdb_dir /mnt/data/omega/cdb
Prepare lighttpd webserver for Omega. Edit configuration file /etc/rc.d/websrv with freenas web ui in tab Advansed > File editor
Add modules mod_cgi and mod_alias in server modules.
server.modules = (
mod_rewrite,
mod_redirect,
mod_access,
mod_auth,
mod_cgi,
""mod_alias"" )

url.access-deny = ( ""~"", "".inc"", "".websrv_htpasswd"" )
static-file.exclude-extensions = ( "".php"", "".pl"", "".fcgi"" )
server.pid-file = ""${pidfile}""
alias.url = ( ""/cgi-bin/"" => ""/mnt/data/omega/www/cgi-bin/"" )
alias.url += ( ""/data/"" => ""/mnt/data/"" )
cgi.assign = ( "".php"" => ""/usr/local/bin/php"",
"".cgi"" => ""/usr/bin/perl"",
.pl => ""/usr/bin/perl"",
.rb => ""/usr/bin/ruby"",
.crest => ""/usr / bin / eruby"",
.py => ""/usr / bin / python"",
.am => """",
omega => """")
# include rewrite rule for main config file
include ""/etc/rc.d/webserv.inc.conf""
Green color mark added lines
Create a search page. I’ll just use /mnt/data/omega/www/xap.html
Code: Select all

Code: Select all

<html><head>
<title>Intranet Search</title>
</head>
<body bgcolor=""#ffffff"">
<FORM NAME=P METHOD=GET
ACTION=""/cgi-bin/omega"" TARGET=""_top"">
<center>
<INPUT NAME=P VALUE="""" SIZE=65>
<INPUT TYPE=SUBMIT VALUE=""Search"">
<hr>
<INPUT TYPE=radio NAME=DEFAULTOP VALUE=or > Match any word
<INPUT TYPE=radio NAME=DEFAULTOP VALUE=and CHECKED> Match all words
</center><br>
<INPUT TYPE=hidden NAME=DB VALUE=""default"">
<INPUT TYPE=hidden NAME=FMT VALUE=""query"">
<INPUT TYPE=hidden NAME=xDB VALUE=""default"">
<INPUT TYPE=hidden NAME=xFILTERS VALUE=""--O"">
</FORM>
<hr>
</body></html>
Make symbolic link 
Code: Select all

Code: Select all

ln -s /mnt/data/omega/templates /mnt/data/omega/www/templates
Document root for freenas web server must be set to /mnt/data/www/ Save and restart web server for test configuration file.
Reboot Freenas now
Next step - try by hand make index for download folder. I was add files, downloaded from sources and extracted into download folder. Only for test..
Code: Select all

Code: Select all

/usr/local/bin/omindex --db /mnt/data/omega/data/default --url /data /mnt/data --depth-limit=0
Wait for ending
Now fire up your browser and validate the result by surfing over to the IP address of the server. If that worked out well too, the last steps is
1. remove /mnt/data/omega/download
2. remove /mnt/data/omega/data/default
3 correct omindex arguments for really shared folders.
4 try by hand index and search files and add omindex to crontab, so that it refreshes the index automatically. In my case, once a week is enough.
ENJOY!!
I will continue to adapt the search For Freenas
"
"
by alexey123»26 Jan 2013 03:20
Ok, I built xapian-omega into jail. In first, I create new jail named omega.local and his ip = 10.0.0.22, start into ssh server. I use old xapian-omega, because I want to index files, such .xml, .jedec, .pof, .pl2, .pld, .bin, and I recompile omindex for my work.
Install
Code: Select all

Code: Select all

portsnap fetch extract
cd /usr/ports/www/apache22 =>=> make install clean
cd /usr/ports/www/xapian-omega10 =>=> make install
cd /usr/ports/graphics/xpdf =>=> make install clean
Uncheck WORDVIEW for catdoc
Code: Select all

Code: Select all

cd /usr/ports/textproc/catdoc =>=> make install clean
cd /usr/ports/archivers/unzip =>=> make install clean
cd /usr/ports/archivers/gzip =>=> make install clean
cd /usr/ports/textproc/antiword =>=> make install clean
cd /usr/ports/textproc/unrtf =>=> make install clean
cd /usr/ports/print/catdvi =>=> make install clean
Catdvi install slow and when it compile and install to system I have time for repair xpdf. Need only create 2 links
Code: Select all

Code: Select all

ln -s /usr/local/libexec/xpdf/pdftotext /usr/local/bin/pdftotext
ln -s /usr/local/libexec/xpdf/pdfinfo /usr/local/bin/pdfinfo
For apache need edit config file /usr/local/etc/apache22/httpd.conf. I define port, host and cgi-bin folder. Edited lines:
Listen 10.0.0.20:80
# LoadModule unique_id_module libexec/apache22/mod_unique_id.so
ServerName 10.0.0.22:80
ScriptAlias /cgi-bin/ ""/usr/local/www/xapian-omega/cgi-bin/""
<Directory ""/usr/local/www/xapian-omega/cgi-bin"">
AllowOverride None
Options None
Order allow,deny
Allow from all
</Directory>
I create additional config for my files /usr/local/etc/apache22/Include/files.conf
Alias /files /path/to/files
<Directory ""/path/to/files"">
Options Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Add apache22_enable=""YES"" to /etc/rc.conf and start apache with /usr/local/etc/rc.d/apache22 start
Create folder for indexes
Code: Select all

Code: Select all

mkdir -p /usr/local/lib/omega/data/
Copy over the templates.
Code: Select all

Code: Select all

cp -rfv /usr/ports/www/xapian-omega10/work/xapian-omega-*/templates /usr/local/lib/omega/ 
Create config for omega /usr/local/www/xapian-omega/cgi-bin/omega.conf
# Directory containing Xapian databases:
database_dir /usr/local/lib/omega/data
# Directory containing OmegaScript templates:
template_dir /usr/local/lib/omega/templates
# Directory to write Omega logs to:
log_dir /var/log/omega
# Directory containing any cdb files for the $lookup OmegaScript command:
cdb_dir /var/lib/omega/cdb
Create a search page. /usr/local/www/apache22/data/search.html.
Code: Select all

Code: Select all

<html><head><title>Intranet Search</title></head>
<body bgcolor=""#ffffff"">
<FORM NAME=P METHOD=GET
ACTION=""/cgi-bin/omega"" TARGET=""_top"">
<center><INPUT NAME=P VALUE="""" SIZE=65><INPUT TYPE=SUBMIT VALUE=""Search"">
<hr>
<INPUT TYPE=radio NAME=DEFAULTOP VALUE=or > Match any word             
<INPUT TYPE=radio NAME=DEFAULTOP VALUE=and CHECKED> Match all words          
</center><br>
<INPUT TYPE=hidden NAME=DB VALUE=""default""><INPUT TYPE=hidden NAME=FMT VALUE=""query""><INPUT TYPE=hidden NAME=xDB VALUE=""default"">
<INPUT TYPE=hidden NAME=xFILTERS VALUE=""--O"">
</FORM>
<hr>
</body>
</html>
Thats all. Now try first index
Code: Select all

Code: Select all

/usr/local/bin/omindex --db /usr/local/lib/omega/data/default --url /files /path/to/files --depth-limit=0
Last edited by alexey123 on 15 Dec 2013 09:47, edited 1 time in total.
"
"
by alexey123»30 Jan 2013 17:38
Result my index
I create index for folder , contained more 52000 files and with size more than 44 G
001.png
001.png (9.78 KiB) Viewed 77096 times
I mount my share to jail /mnt/public folder over fstab.omega
Code: Select all

Code: Select all

/mnt/disk/public /jail/omega/mnt/public nullfs ro 0 0
I begin to index with my Lab server x86-full on AMD Sempron(tm) 2200+ / 512M, but not success, because I did not have enough memory.
I add 512M RAM and increase swap to 2 G - and index completed
002.png
CPU load
003.png
Swap nod used in case 1G ram
Really I have 10G files, which can be include to index, such html, documents, tables, pdf and omindex build his index with size 413M, so ~5% of real size
All index placed in RAM, when omindex make his job, so if Nas4free-full need to work 512M, so calculate minimum RAM I can as
Code: Select all

Code: Select all

512 + 0.05*{document_folder_size}
Result I can see over browser (search took 0.04 sec)
004.png
Xapian-omega and mrtg running under jail
"
"
by fritz»23 Mar 2013 00:28
Thank you alexey for your tutorial,
I installed xapian-omega in a jail (using thebrig nas4free extension) successfully in few hours on a VM
Without your help, I would probably have spend many days before to succeed.
Regards,
fritz
"
"
by alexey123»13 Aug 2014 15:36
Small addon for search
Xapian-Omega is very good tool for search manuals and another documents, but sometimes need search tool for another files, such .bin, .gho or another binaries.
For do search faster ( I cannot remember all 50000 files and his filenames after 5-10 years ) I put binary files into specific folder and make scan with my scripts.
My script make search by foldername < part of foldername > and filename <part of filename > , equivalent unix command find
First script, I call it spyder.php
Code: Select all

Code: Select all

#!/usr/local/bin/php-cgi -f
<?php
$scriptdir = '/mnt/storage/www/tools/spyder';
// read config
if (is_file($scriptdir . '/spider.conf')) { $spiderconf_1= file($scriptdir . '/spider.conf');} else print ""config not found"";
$spiderconf = preg_grep(""/^#.+$/"",$spiderconf_1,PREG_GREP_INVERT);
$workdir = preg_grep(""/workdir=/i"",$spiderconf);
if (count ($workdir) < 1 ) { print ""workdir not defined""; exit;} 
$workdir_n = convert_config_line_1($workdir);
$virtualf = preg_grep(""/virtualfolder=/i"",$spiderconf);
if (count ($workdir) < 1 ) { print ""Virtual folder not defined""; exit;} 
$virtualf = convert_config_line_2($virtualf);
// begin scan
foreach ($workdir_n as $dirs) { 
$dirs = rtrim($dirs);
if (is_dir($dirs)) { exec (""find {$dirs} -type f"", $spider_res);} else {print ""\n Directory "" . $dirs . "" not readable\n"";}
}
for ($i=0;$i<count($virtualf[0]);$i++) {
if (is_dir($virtualf[0][$i])) {
$spider_res_n = str_replace ($virtualf[0], $virtualf[1], $spider_res);
} else {}
}
if (is_file($scriptdir.""/spyder.db"")) {unlink ($scriptdir.""/spyder.db"");}
$serializedData = serialize($spider_res_n); //where '$array' is your array
file_put_contents($scriptdir . '/spyder.db', $serializedData);
//print ""Scan executed at "". date('l jS \of F Y h:i:s A');
exit
function convert_config_line_1($array) {
foreach ($array as $line) {
$line_a= explode (""="", $line);
$array_n[] =  $line_a[1];
}
return $array_n;
}
function convert_config_line_2($array) {
$array1 = convert_config_line_1($array);
for ($i=0;$i<count($array1);$i++) {
$line_a= explode ("":"", $array1[$i]);
$array_n[0][$i] = $line_a[0];
$array_n[1][$i] = rtrim ($line_a[1]);
}
return $array_n;
}
?>
This script make database file and I run it by cron every week. It need config file, for example :
Code: Select all

Code: Select all

#comment mus begin with ""#""
#Workdir syntacsis must be wrote as workdir=/full/path/to/scanned/folder 
#virtual folder must be wrote as virtualfolder=/full/path/to/scanned/folder:/virtual/folder
workdir=/mnt/disk/public/firmware
workdir=/mnt/disk/public/diskimages
virtualfolder=/mnt/disk/public/firmware:/firmware
virtualfolder=/mnt/disk/public/diskimages:/diskimages
Under web accessable folder I put another script. Example:
Code: Select all

Code: Select all

<?php 
// May be need define full path to database file
$db_file = file_get_contents ('spyder.db');
$arr = unserialize ($db_file);
?>
<html> 
<head>
<meta http-equiv=""Content-Type"" content=""text/html; charset=windows-1251""> 
<title>Firmware search</title>
</head> 
<body>
<BODY BGCOLOR=""white"">
<meta http-equiv=""Content-Type"" content=""text/html; charset=windows-1251""> 
<center></center>   
   <center><form method='get'><font face=""Times New Roman"" size=""+1"" color=""#001010""> 
    Type name :    <input type='text' size='15' name='pattern' /> 
    <input type='submit' value='Find' name=""add"" /><br /><br /> 
  </form></center>
 </body>
 </html>
<?php
if(isset($_GET['add'])) 
{ 
  $patt = $_GET['pattern'];
    if (!empty($patt)) //test for null input
  {
    $patt_a = explode ("" "", $patt);
   
 foreach ($patt_a as $pattern) {
 $result = preg_grep(""/{$pattern}/i"", $arr);
 foreach ($result as $result_n) { echo ""=>nbsp;=>nbsp;"". $result_n . ""<br />"";}
 }
  
  }
 
}
?>
Result - I make search by ""iemens""
005.png
May be anybody need my idea
"
Post Reply