Search for all terms regardless of order

In all of the Search boxes (Devices, Apps, etc.) , please allow searching of multiple terms regardless of order.

For example, "Office SO" (without the quote marks) would filter the Devices list to show "Motion Sensor - Office SO" but would omit "Remote - Office Lighting TU" (SO is my code for Sonoff, TU is my code for Tuya).

Right now, I have 9 devices that have the word "Office" in their name. With searching of multiple terms regardless of order, I could easily filter that list down to more pertinent devices of interest.

ChatGPT shows this example of what might work, using Python:

def search_terms(text_list, query):
    query_words = set(query.lower().split())  # Convert query to a set of lowercase words
    return [text for text in text_list if query_words.issubset(set(text.lower().split()))]

# Example usage:
text_list = [
    "apple banana cherry",
    "banana cherry apple",
    "cherry apple",
    "banana cherry"
]

query = "cherry apple"
matching_items = search_terms(text_list, query)
print(matching_items)

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