'Create Searchresults Array
searchresults=[]
'create associative array for faster searchingg
clist={}
'Loop through content list categories
For x=0 To m.masterlist.count()-1
'Loop through items in each category
For y=0 To m.masterlist[x].count()-1
'If search term is 1 character long, then check for matches based on title only
If Len(FinalSearchTerm)=1
'search titles that begin with that character and skip other fields
If LCASE(m.masterlist[x][y].Title.Left(1))=LCASE(FinalSearchTerm)
If clist.doesexist(m.masterlist[x][y].contentID)=FALSE
searchresults.push(m.masterlist[x][y])
clist.AddReplace(m.masterlist[x][y].contentID,0)
End If
End If
Else
If(Instr(1,LCASE(m.masterlist[x][y].Title),LCASE(FinalSearchTerm))>0) or (Instr(1,LCASE(m.masterlist[x][y].Director),LCASE(FinalSearchTerm))>0) or (Instr(1,LCASE(m.masterlist[x][y].Actors[0]),LCASE(FinalSearchTerm))>0) or (Instr(1,LCASE(m.masterlist[x][y].Actors[1]),LCASE(FinalSearchTerm))>0) or (Instr(1,LCASE(m.masterlist[x][y].Actors[2]),LCASE(FinalSearchTerm))>0) or (Instr(1,LCASE(m.masterlist[x][y].Description),LCASE(FinalSearchTerm))>0) or (Instr(1,m.masterlist[x][y].ReleaseDate,FinalSearchTerm)>0)
If clist.doesexist(m.masterlist[x][y].contentID)=FALSE
searchresults.push(m.masterlist[x][y])
clist.AddReplace(m.masterlist[x][y].contentID,0)
End If
End If
End If
Next
Next
"destruk" wrote:"norcaljohnny" wrote:
With all due respect 3-4 seconds is extremely slow. With 19,000 items my results return in .2 seconds via server side and php.
And with all due respect it could take 3-4 seconds to download the data from your server to the client app. So... you know, we can argue about which is better for months if you prefer, but really it's up to the individual channel developer to decide what they want to use. While results might return from your server it still takes the roku devices (low end and roku 4) 5 seconds to parse the results for 19,000 items, so that is still slow. But since3 you can't make that part faster, well.... Maybe chill out, we're not fighting here, we are discussing different techniques to accomplish a goal dude.
"lylyahiko" wrote:
For the actual search bar itself. When I select the button to search a Poster Node needs to be created with a minikeyboard attached to it. How would I go about doing that?
"norcaljohnny" wrote:
Here is a sample of how i do it
1st I have a master file in xml format, no database needed.
I named it "all.xml" and place it in the root folder of my server.
Sample:<?xml version = "1.0" encoding = "utf-8" standalone = "yes" ?>
<Content>
<item url="a_bit_of_fry_and_laurie" title="A Bit of Fry and Laurie" year="1987" hdposterurl="yourPosterUrl"/>
</Content>
2nd i create a search script that will return the results.
I name it "livesearch.php" and place it in the root folder of my server.
"\n" = end of line and "i" = not case sensitive
I then append the url to a base url that handles the actual video file on click of the results.
Sample:<?php header("Content-type: text/xml")?>
<?php echo "<?xml version = \"1.0\" encoding = \"utf-8\" standalone = \"yes\" ?>\n" ?>
<?php echo "<Content>\r\n" ?>
<?php
$q=$_GET["q"];
$xml=file_get_contents("all.xml");
preg_match_all("/.*title=\".*$q.*\"*\n/i", $xml, $output,PREG_SET_ORDER);
foreach($output as $file){
$file= $file[0];
echo "$file";
}
<?php echo "</Content>" ?>
So now if I go to "https://myWebAddress.com/livesearch.php?q=searchTextInput" it gets returned with all results parsed in a Roku xml format.
I also use a function so the results are returned as they type and not by a search button being pressed.
This method also allows all results returned regardless of where the word falls in the search and you dont have to worry about exact matches.
IE ... "https://myWebAddress.com/livesearch.php?q=brady" will return "the brady bunch" assuming that is a file.