# How to create relative search

**URL:** <https://community.thunkable.com/t/how-to-create-relative-search/3049138>\
**Category:** Questions about Thunkable X\
**Tags:** firebase, help\
**Created:** [June 9, 2024, 1:19pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138 "2024-06-09T13:19:45Z")\
**Posts on this page:** 14\
**Page:** 2

<div class="post-metadata">

**Author:** ![itsvedanttikareztlgx](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/itsvedanttikareztlgx/32/179520_2.png) [@itsvedanttikareztlgx](https://community.thunkable.com/u/itsvedanttikareztlgx)\
**Post date:** [June 24, 2024, 6:29pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/22 "2024-06-24T18:29:30Z")

</div>

hey so I went through the blocks and they work fine, but I want a way to integrate this in our search feature too since search is the main aspect of our app

so how can I create city specific search?  
such that  
when I search library by book title, I get results within the city we have selected

---

<div class="post-metadata">

**Author:** ![marion.dorsett](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/marion.dorsett/32/175129_2.png) [@marion.dorsett](https://community.thunkable.com/u/marion.dorsett)\
**Post date:** [June 24, 2024, 6:49pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/23 "2024-06-24T18:49:08Z")

</div>

It sounds like maybe you need to create a list of the cities, libraries and book titles. Then workout the logic to return the desired data based on the selected list item. We could do this with functions and passing the specific arguments… you’ll just have to duplicate the function on the different screens if necessary.

Let me ask this, what happens if someone searches for a partial string like “mockingbird”… should it find “To Kill a Mockingbird”? What I’ve done so far has only looked for the string using an = statement, not a partial match.

---

<div class="post-metadata">

**Author:** ![itsvedanttikareztlgx](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/itsvedanttikareztlgx/32/179520_2.png) [@itsvedanttikareztlgx](https://community.thunkable.com/u/itsvedanttikareztlgx)\
**Post date:** [June 24, 2024, 7:05pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/24 "2024-06-24T19:05:25Z")

</div>

yes I would want that, the initial plan was to create a robust search feature, not to aim too high but something close to google search

it shows suggestions while you search for a thing, it can also recognize partial searches to some extent as I don’t want purely partial search feature

but in a nutshell yes I want partial search

---

<div class="post-metadata">

**Author:** ![marion.dorsett](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/marion.dorsett/32/175129_2.png) [@marion.dorsett](https://community.thunkable.com/u/marion.dorsett)\
**Post date:** [June 24, 2024, 10:26pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/25 "2024-06-24T22:26:56Z")

</div>

I added a new home screen to the mock up, and it is configure for the relative search. Right now the data is returned to a list for the results from the compiled lists.

 ![relative-search-07](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/3/6346db26e34bc1e71eb711137a64c661c7b54e55.png)

I’m not sure how you want to to display the data, but based on the other screens, if a city is returned would they go to the screen w/ the libraries listed?  
If they click on a library would they see the books?  
If they click on a book would they see the book details, and all of the libraries in the cities they can find the book?

---

<div class="post-metadata">

**Author:** ![itsvedanttikareztlgx](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/itsvedanttikareztlgx/32/179520_2.png) [@itsvedanttikareztlgx](https://community.thunkable.com/u/itsvedanttikareztlgx)\
**Post date:** [June 25, 2024, 4:01pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/26 "2024-06-25T16:01:39Z")

</div>

Okay so I made a video of how exactly I want the app to work

> **[Recording 2024-06-25 212142.mp4](https://drive.google.com/file/d/1Ru9yx_pGqMgVdFSL74hZsSIUz1COT5zY/view?usp=sharing)**
>
> Google Drive file.

check it out and you’ll get the exact idea of how I want the app to function

---

<div class="post-metadata">

**Author:** ![marion.dorsett](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/marion.dorsett/32/175129_2.png) [@marion.dorsett](https://community.thunkable.com/u/marion.dorsett)\
**Post date:** [June 27, 2024, 12:13pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/27 "2024-06-27T12:13:28Z")

</div>

I just watched the video, and I think I understand what you’re trying to accomplish. I think I’m headed in the right direction with the mock up I started based on what you’re looking to do.

---

<div class="post-metadata">

**Author:** ![marion.dorsett](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/marion.dorsett/32/175129_2.png) [@marion.dorsett](https://community.thunkable.com/u/marion.dorsett)\
**Post date:** [June 27, 2024, 2:10pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/28 "2024-06-27T14:10:00Z")

</div>

Working through this, bit by bit, and here’s what I have so far.  
[https://x.thunkable.com/projectPage/66796d594c50947feef58e7a](https://x.thunkable.com/projectPage/66796d594c50947feef58e7a)

I just need to refactor the search page to display the libraries in the city w/ that book, just don’t have time to spend on it now.

---

<div class="post-metadata">

**Author:** ![itsvedanttikareztlgx](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/itsvedanttikareztlgx/32/179520_2.png) [@itsvedanttikareztlgx](https://community.thunkable.com/u/itsvedanttikareztlgx)\
**Post date:** [June 27, 2024, 4:04pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/29 "2024-06-27T16:04:10Z")

</div>

hey that is actually helpful, I actually have a different issue that I have been facing

you remember our very first search feature at the beginning of this thread?

so this happens in it  
so when you search book, you get library

 ![Screenshot 2024-06-27 212611](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/1/61209af0a6269805680dacc5c525b3c3770734f8.png)

but when I go back to the search feature and search something in the same session, it does show right results but it shows then twice in the list like you can see below

 ![Screenshot 2024-06-27 212812](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/7/f76cafa3084ab305021736e3ece6ca5ab72c86b6.png)

here are all the blocks for the search page

 ![Screenshot 2024-06-27 213202](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/b/ebf0e9673fd009552094988f57a09d65519207b3.png)  
 ![Screenshot 2024-06-27 213154](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/b/6bbbfbda84cbd6d892605105b6ab5665e8ff2d52.png)  
 ![Screenshot 2024-06-27 213129](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/c/e/ce24d8e8b9474e37884c97a03b3c9a382427c265.png)

how can I solve this issue?

---

<div class="post-metadata">

**Author:** ![marion.dorsett](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/marion.dorsett/32/175129_2.png) [@marion.dorsett](https://community.thunkable.com/u/marion.dorsett)\
**Post date:** [June 27, 2024, 4:25pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/30 "2024-06-27T16:25:12Z")

</div>

To keeps items from being duplicated in the list you need to make sure it doesn’t already exist in the list using the “does list contain” block.

Here’s an example:

 ![relative-search-08](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/8/6/865b4bea8883c82cdaa2cce9031b1daa188f18ad.png)

You just need to make sure you replicate it where you build out your list, and swap out your var names.

---

<div class="post-metadata">

**Author:** ![itsvedanttikareztlgx](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/itsvedanttikareztlgx/32/179520_2.png) [@itsvedanttikareztlgx](https://community.thunkable.com/u/itsvedanttikareztlgx)\
**Post date:** [June 27, 2024, 5:25pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/31 "2024-06-27T17:25:30Z")

</div>

so I’m confused as to which variables do I use to create this for this to work

I tried some combinations in searchInput function and also in getLibData function but they aren’t really working

---

<div class="post-metadata">

**Author:** ![marion.dorsett](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/marion.dorsett/32/175129_2.png) [@marion.dorsett](https://community.thunkable.com/u/marion.dorsett)\
**Post date:** [June 27, 2024, 5:34pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/32 "2024-06-27T17:34:41Z")

</div>

Out of the blocks you listed there’s only one that’s adding anything to a list:

 ![relative-search-09](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/2/22abc4127e7b0b8e237e8e3e0ff10b5b20b0cea6.png)

I would wrap that in the “if/do” bock and only add that item to the list, if it’s not already in the list.

---

<div class="post-metadata">

**Author:** ![itsvedanttikareztlgx](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/itsvedanttikareztlgx/32/179520_2.png) [@itsvedanttikareztlgx](https://community.thunkable.com/u/itsvedanttikareztlgx)\
**Post date:** [June 27, 2024, 5:42pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/33 "2024-06-27T17:42:13Z")

</div>

hey it got solved thank you the app is almost ready to launch

gotta make some changes but it is almost ready

so our long journey finally ends lol

but I am very thankful for all your help

thank you

---

<div class="post-metadata">

**Author:** ![marion.dorsett](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/marion.dorsett/32/175129_2.png) [@marion.dorsett](https://community.thunkable.com/u/marion.dorsett)\
**Post date:** [June 27, 2024, 6:46pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/34 "2024-06-27T18:46:57Z")

</div>

YAY! That’s awesome.

It’s been fun. I’m new to Thunkable, and the best way to learn anything is to solve the issues other people are having, and I’ve leaned a lot through the process myself. 😃

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [September 25, 2024, 6:47pm UTC](https://community.thunkable.com/t/how-to-create-relative-search/3049138/35 "2024-09-25T18:47:41Z")

</div>

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

[Previous page](https://community.thunkable.com/t/how-to-create-relative-search/3049138.md?page=1)
