I want to see if it is possible for the community to help me in this search engine that I am creating.
Let me explain what it is, is a set of txt files that are obtained from exporting the chats of the Whastapp application. The format of these chats are characterized by the fact that they start with the date, the name of the person making the comment or phone #, something like this:
05/09/18 6:54 a.m. - Elena Hidalgo Corredora: SKY GROUP SALE PRICE LOW REF100000REF AND REF40000REF ☆☆☆☆ Land in hills of Guataparo of 1500M2 with perimeter fence, electric points, water tank, electric gate, bathrooms, advanced construction, main road and ready to sign. 300,000 NOW 100,000 Another 830M2 with perimeter fence in 60,000 Ref. NOW 40,000
I have the problem partially solved, on the one hand I have a search form where the person places something like this:
Tulipán San Diego 10,000 apartment
Any search, that's just an example. What done:
The results are acceptable, but it is not exactly what I am looking for, because it turns out that it iterates me word by word and shows as result all the keys that the word Apartment contains and if there is one that contains Apartment and Tulipán, it shows it 2 times , so it does with every word.
What I want is for me to show only the keys that contain the 3 or 4 words that the form is indicating. Here he left the php code:
//Capturamos la búsqueda
$busqueda = $_POST['busqueda'];
$fecha = $_POST['fecha'];
$arrayb = explode (" ", $busqueda);
$array = explode("|", file_get_contents('chat'.$fecha.'.txt'));
for($i=0 ;$i<count($array);$i++)
{
for($u=0 ;$u<count($arrayb);$u++)
{
$found=stripos($array[$i],$arrayb[$u]);
if($found)
{?>
<div class='contaniner'>
<div class="row">
<div class="col">
<?php echo $array[$i];
echo "<br><br>";?>
</div>
</div>
</div>
<?php
}
}
}
Here is the demo, only the first 5 dates of the month of September 2018 can be used. php search in flat files