Forum for discussing general topics related to Couch.
5 posts Page 1 of 1
Hello everyone. I need your ideas for my search system. So what we have,

    I have some clonable pages.
    I have 3 editable regions in these clonable pages.
    My editable regions are: title, start-date, end-date.

Now, the search system searches in every editable region at clonable pages. What I want is, I want to search in my clonable pages for those 3 variables. I mean, I want to search for the title between start-date and end-date.

One other problem is, let's say my page name is 'test' and if I search for 'te' it doesn't show my page which is named 'test'. To see that page, I have to write 'test' the full text. How do I find solutions for my problems?

Thanks in advance for all of your comments,
knbyr
Hi,

The 'search' feature won't allow this kind of granularity, I'm afraid.

We may try using the solution given in this thread instead - viewtopic.php?f=8&t=7620 but it will have a problem - it works only with 'custom' fields; that should be ok with the two date fields but the 'title' field you are searching for is a 'system' field and so will be ignored.

As a workaround, you may try defining a duplicate text field that contains the same value as title (we can keep this field hidden and there are ways of populating this field automatically whenever the page is saved - so to begin with, just use it as is and we'll get to that part if the solution seems ok).
For the shortest possible searches (starting from 1 letter) or wildcard searches, I have developed a function outlined here viewtopic.php?f=8&t=11368&start=10#p30477 which may very well be adapted to your use case.

If your search was only in backend, additionally, I'd recommend datatables, which allow filtering rows on the fly. But if your main concern is a frontend search by visitors, then the mentioned custom function is the best choice - it can be tailored to your needs, only include certain custom or system fields etc, etc.

The code, though, is rather advanced so take a look at it and see fo yourself. If you like how it works you may ask me in PM for a customization job.
Thank you everyone for all of your kind comments, I'll contact you via PM @trendoman.

Thanks,
knbyr
Any luck? Haven't heard from you since then.
5 posts Page 1 of 1