Hi!
I am a designer and do not know code at all. However, I was able to code a search for my database through viewing this video: https://www.youtube.com/watch?v=Hx7_8-lRsW0&feature=youtu.be
The code works fine, but I would love add some more to it.
I have created a page where my users should be able to search for technical papers. My database includes: Author name, Title of the paper, Date published, and a link to the PDF of the file. This is what it looks like in the editor:
![](https://static.wixstatic.com/media/a27d24_754b6d3ba5464034936ea5f81d34bfa5~mv2.png/v1/fill/w_980,h_402,al_c,q_90,enc_auto/a27d24_754b6d3ba5464034936ea5f81d34bfa5~mv2.png)
The code I have used for the search bar so far only lets my users search for papers by their title. I would like to give them the opportunity to also search for papers by author name or year. What could I add to the code to make this happen?
Here is what the code looks like today:
![](https://static.wixstatic.com/media/a27d24_8ce873ce3ef6430dbfff60024fd6ad2b~mv2.png/v1/fill/w_744,h_485,al_c,q_90,enc_auto/a27d24_8ce873ce3ef6430dbfff60024fd6ad2b~mv2.png)
Remember, I do not know code at all, so I don't understand much of this..
Hope someone can help me out and that there is a quick way to add to the code!
All answers are appreciated.
Best regards,
Ragnhild
Try this...
$w("#dataset1").setFilter(wixData.filter() .contains("title", $w("#iKeyword").value) .or(wixData.filter() .contains("author", $w("#iKeyword").value)) .or(wixData.filter() .contains("datePublished", $w("#iKeyword").value)))
Thanks for your reply, Rachel!
Now it looks like this:
But as i changed the code, nothing happens when I type in the search field anymore. Any suggestions?
Hi Ragnhild,
You could try using the or() function...
$w("#dataset1").setFilter(wixData.filter() .contains("title", title) .or(wixData.filter() .contains("author", author)) .or(wixData.filter() .contains("year", year))
:)