hey there :-)
I am facing a small problem, can you recommend me something? my problem is like this:
now when a user searches some keywords on my website i extract data of website which includes complete page details. at a time i am fetching 10 results!
so now assume
echo $out['full_txt']; // this echos complete page i.e. each and everything on page!
// this $out['full_txt'] is a string!
Now what i want to do is Depending upon keywords searched, i want to extract lines from this full_txt . Eg. I searched "hello world"
then i want to display website description as the lines which consists of either hello or world or both . The description is required to be modified from $out['full_txt'] thing. How can I achieve it? help would be really appreciated. thank you so much!
Here the words are the keywords searched by user. Help is really very much appreciated.
Is there any way that substr or other function can help me out from this situation?
1) Decide how many displays you want per 'page' (record). 2) Search for your keywords in an SQL/DB using MATCH/FULLTEXT? 3) For each record, cut all sentences into lines (using explode on "\n" or ". " or ".\n") - this may will be different if your content is stored in html format. 5) Print the page title 4) Loop through the lines, one at a time, echoing the first say 3 line hits as text…
Ardav you got it exactly right.. I wanna display output like how google shows description!
@ardav and @ pritaeas I am making a search engine as project.. I have completed with almost everything else, Only part remaining is how to show Google Like Description?
If i am searchin a query on google, google gives description as lines containing those searched keywords.
Here in my search engine i got a column with name full_text which consists of everything in a webpage. I want to extract only those lines which consists any of the keywords searched and show it to user.
1) Decide how many displays you want per 'page' (record).
2) Search for your keywords in an SQL/DB using MATCH/FULLTEXT?
3) For each record, cut all sentences into lines (using explode on "\n" or ". " or ".\n") - this may will be different if your content is stored in html format.
5) Print the page title
4) Loop through the lines, one at a time, echoing the first say 3 line hits as text in an array, but keep looping to get the total hits number.
5) Echo a last line saying something like 'Displaying 3 out of  matches for this page'. Where the 27 is the total number of line hits for that record.
Is that the sort of thing?
Have a go, have a little play. Come back if stuck.
How do I extract 10-15 words separated by "Space" starting from a particular word. Example:
"Welcome to the world of java. Java is platform independent and one of the easy to learn language."
Now I want to extract the 5 words from last occurance of java. i.e.
Output should be : Java is platform independent and
How can I achieve this? I am stuck here :'(
something like above code I am using. But what happens is sometimes for example: instead showing complete word "the" it outputs "t" because of 160 is the length which i specified to be extracted.
After running above script I got output like:
java tutorials introduction introduction t tutorials trainings books social tutorials trainings books social
as you can see after introduction instead of the , it shown only 't'.
Please give some suggestions/ideas.