SEARCH ENGINE PATENT - Finding and matching words in strings

The idea is to make a somewhat bad search engine of some sort.
A user would type a word in the search bar and it would bring up some buttons to click. For instance:

  1. A user typed in something like “Ad Blocker”
  2. The script would search through the TextLabels, buttons, etc. on all pages, trying to find whatever player typed in, it would do so by checking every single word on it
  3. If it found at least one match on the page, it lists the page in the results, else just brings up “Nothing found”

And I don’t even know where to start, string.find? string.match???

Any ideas on how it could be done?

2 Likes

Do you have any code samples I can see of what you’re trying to do, string.find or string.match should work.

1 Like

This sounds like string matching could be used here. However for your case you only need to do word checking.

local Input = "hello and hello again" -- what user types
local Words = Input:split(" ") -- split the string every time there is a space

for i, Word if ipairs(Words) do -- literate over all the words in the input
    if Word == "target word" then 
         -- do whatever here
    end
end
1 Like

It can’t be a specific word as it then destroys the point of it being a search engine.
Can that “target word” be basically all words on all pages, so it checks which one has the most matches, and lists the page?

1 Like
local Ranker = 0	
local Search = "Info on weather, of weather!"		
local Words = string.split(Search:gsub("%p", ""), " ")

for i, Word in ipairs(Words) do
	if Word == "weather" then -- PROBLEM I need it to check EVERY word on EVERY webpage, and increases the ranker (I will make it so every page has it's own one later).
		Ranker += 1	--For testing it's like this 
	end
end

if Ranker > 0 then
	warn("Results found!")
	-- I will also script it so it lists the pages with most matches later
else
	warn("No Results...")
end

This would be the ground for it, but it’s not efficient without resolving the problem.

1 Like

I’ve come up with a solution that is now available as an open-source game. Check out this topic for more info:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.