Recently Browsing 0 members
No registered users viewing this page.
Hello guys, I am building a sort of an archive. Relatively simple, although I have about 8000 records, each with 15 fields (text, int, images, url). I created a crude search system with a form (emulating the famous Skyscrapper example) to filter through the system. Everything works but it is quite slow... I have 2 questions which are related:
1. How can I search through the database?
2. What is a good practice to display many records like these?
1. I am retrieving the results with
$songs = $pages->findMany('template=nk-song'); Then I do a foreach to render them all. I am unsure if that is a good way. If I render all of them on the page, it creates thousands of divs with a bit of text, and this can take a while (10s-15s).
2. This one is even worse :D as every time I retrieve my desired records with something like this:
$page->find("field_to_search_through~=my_query_string") I get between 20 and 200, but when I render them I am creating iframes with YouTube videos and that can take up to 10s to finish. I "solved" it by only loading the iframes if they are in view with IntersectionObserver on the client-side. But I feel there is a more precise PHP / ProcessWire approach.
Just to clarify, I started doing all of this custom rendering and querying because tools like ElasticSearch or SearchEngine were a bit complicated and I needed a simple to retrieve information and then display it in my own way.
I have a website with multiple content types that I want to be accessible through search. I really like the live search on processwire.com, that sorts content types while typing. I tried to find the code to recreate this, with no luck. Does anyone know if this is jquery, specific jquery plugins, json/xml cached files, and what kind of PHP code is used? Any tip that point me in the right direction would be much apperciated.
The search result listing seems fairly easy to create with sorting through parameters.
I have a search page loosely based on Skyscrapers where I'm parsing a selector with options 'beds', 'bathrooms', 'size' fields. It is working well until I select 'Any' after I've run a search. This is where no results are returned (/?beds=&bathrooms=&size=&submit=). I want it to reset and show all results.
I hope this isn't too vague.
i am trying to add a kind of "intelligent" search.
Is there any way to ignore punctuation and extra chars.
When I type "somebody elses" that I still get the result "SOMEBODY ELSE´S CAR, 2005"
The problem is the extra ´ … if I don't type it I don't get the result.
So far I am using %=query (which isn't enough, I know)
So the idea would be something like that:
$selector = "sanitize(title|text)%=$q, limit=50";
I know, it's not gonna work like that … just to illustrate.
I have two Page Reference fields: Category and Subcategory. Category is parent of Subcategory, and can have 0 to n Subcategories. Fields are selected by dropdown selection.
I'm trying to achieve following logic:
1. Select Category (obviously works)
2. Change Subcategory options based on selected Category (this works)
3. Hide the Subcategory field if Category has no Subcategories (to prevent weird dropdown with nothing to select)
I have tried to investigate two possible alternatives to achieve step 3:
A) Make dynamic condition into Subcategory selection's "Only visible if..." field
B) Make a hook that fires when Category changes, then hides Subcategory field if Category has no children
So far I haven't been successful in either. Conditions I've tried always lead to hidden field, and I haven't been able to find set up a hook that fires on field change.
So here's the question (finally): Is there a way to alter field visibility in API, for example in ready.php or inside a hook? In API I could loop through categories, find the ones that have children and then make a selector based on their IDs.