Recently Browsing 0 members
No registered users viewing this page.
I want to allow full text search on my site. There is a very nice solution that comes right out of the box:
$selector = "title|body~=$q, limit=50"; This works, but to make it even better I would want to give higher weight to pages where the search term occurs in the title, than if it just occurs in the body. After all, a page with the title "Wine from France" is probably the best match for the search "france wine". How do I accomplish this in ProcessWire?
I can see three possible paths, but I am not very fond of any of them:
Do a direct SQL query, circumventing the API, along these lines. But I would prefer to abstract away the database layout if at all possible. Use something like ElasticSearch, but to be honest that would be to complicated to set up and maintain in the long run. Make multiple lookups, first for matches in the title, then for matches in the body, and merge and sort in PHP. My suspicion is that this would get complicated quite quickly. For instance, how do you deal with a page that has two of the three search terms in the title and the third in the body? Is there a magic option four I should look into? Or are any of the above options better than the others? Any input is welcome!
I'm working on a CLI script that renders paginated pages.
Therefore I iterate trough paginated pages and set the page number and render the result.
My problem is, after calling the render function for the first time, the output doesn't change even if I change the page number.
I'm using a template that renders a pagination of its children:
<?php echo $page->children("limit=3")->render(); ?> I can view the paginated results in the Browser:
/page-rendering-pagination/ /page-rendering-pagination/page2 /page-rendering-pagination/page3 ... When trying to render the different pages using the API I always get the first result, even if I change the page Number.
<?php namespace ProcessWire; include('./index.php'); wire('input')->setPageNum(1); $p = wire('pages')->get('/page-rendering-pagination'); var_dump($p->render()); // renders first three items wire('input')->setPageNum(2); var_dump($p->render()); // also renders the first three items Am I missing something? Is there some kind of caching mechanism that I'm not aware of?
Thanks for your help.
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'm making my way through my first encounter with ProcessWire, and I'm very near the end of my tasks! I've searched Google, these forums, and for add-ons, but I haven't found any documentation or reference work for implementing boolean searching in the native CMS? Am I missing a thread, add-on, or docs that can point the way? I'm sure I'm not the first to have a need like this? Thanks in advance!