Jump to content

Search the Community

Showing results for tags 'search'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. Hi all I have a text search based upon Ryans search template. Unfortunately, I can't make it work with Repeater Matrix fields inside repeaters. I have a repeater field called "content_sections" and inside, there's a repeater matrix field called "items". As I understand it, the selector for a textfield inside the repeater matrix should be: content_sections.items.textfield But this does not deliver any results at all. Any ideas anyone? Thanks Roli
  2. Hello, how would I do a multi-language website search with just a selector? I have many multi-lang fields and I want to do a search through all of them at once and through all of their language values. Is there a "selector way" of doing this? Maybe something like `title|title:de|title:it`? It seems I have seen this somewhere a long time ago but can't find in any documentation or forum search... Or the only way of doing it is by running separate searches for each language with output formatting off and then consolidating it all in one single results array? Because I still want to give users a result, even if it is in another language than current $user. Visitors mostly will be searching for specific terms that are very similar in all languages, but might be not used in one language version of a single page, for example. Or the user might not have switched language tohis prefered and did the search first, etc.. (many use cases in my situation) Example: $pages->find('title~='.$q) - maybe different operator is needed? /en/search/?q=visit = 1 results /it/search/?q=visit = 0 results Thanks for any advice!
  3. Hi In my search page, I used a selector like this : $searchQuery = $sanitizer->entities($input->get('q')); $searchQuery = $sanitizer->selectorValue($searchQuery); $selector = 'title|subtitle|summary|html_body_noimg~=' . $searchQuery; $matches = $pages->find($selector); I don't have the same results if $searchQuery contains accent or not. For example, with « bâtiment » I have no result with « batiment » I have onea result : « Les bâtiments et les smart-city » Normally I should have the same results? How can I do that ? Thanks for your help
  4. 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. Thank you!
  5. 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.
  6. 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!
  7. Hello, 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.
  8. Hey there, i am trying to add a kind of "intelligent" search. Is there any way to ignore punctuation and extra chars. e.g. 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. Best, Stefan
  9. Hello! 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!
  10. Hello everyone! I am trying to add my repeater matrix fields to the search selector, but unfortunately nothing seems to work for me. I have following search code in my search.php: <?php namespace ProcessWire; // look for a GET variable named 'q' and sanitize it $q = input()->get('q'); // sanitize to text, which removes markup, newlines, too long, etc. $q = sanitizer()->text($q); // did $q have anything in it after sanitizing to text? if($q) { // Make the search query appear in the top-right search box. // Always entity encode any user input that also gets output echo '<input id="search-query" value="' . sanitizer()->entities($q) . '">'; // Sanitize for placement within a selector string. This is important for any // values that you plan to bundle in a selector string like we are doing here. // It quotes them when necessary, and removes characters that might cause issues. $q = sanitizer()->selectorValue($q); // Search the title and body fields for our query text. // Limit the results to 50 pages. The has_parent!=2 excludes irrelevant admin // pages from the search, for when an admin user performs a search. $selector = "title|body~=$q, limit=50, has_parent!=2"; // Find pages that match the selector $matches = pages()->find($selector); } else { $matches = array(); } // unset the variable that we no longer need, since it can contain user input unset($q); ?> <main pw-replace='main'> <?php include('./includes/_pageheadersearch.php'); ?> <div id='content-body' class='uk-section uk-section-large uk-section-large'> <div class='uk-container uk-container-small'> <?php // did we find any matches? if(count($matches)) { // yes we did, render them echo ukAlert(sprintf(_n('Found %d page', 'Found %d pages', $matches->count), $matches->count), "default", "check"); echo ukDescriptionListPages($matches); } else { // we didn't find any echo ukAlert(__('Sorry, no results were found'), "danger", "warning"); } ?> </div> </div> </main> I have tried to add my fields to the selector code (repeater_matrix.aboutsblock_repeaters.mytextfield) . But I didn't get any results. What I am doing wrong? Thanks for your help!
  11. I've been trying to figure this out... It seems like I'm probably missing something really simple, but I'm still puzzled as to how to move forward with this. I'd appreciate any help or suggestions anyone can give. Aim: I'm trying to modify the default search template so that my search results come out sorted firstly with those which contain the search term in the title and secondly with those that contain it in the body. The basic code where I made sure everything was working first was: $selector = "title|body~=$q, template=BN-article|BN-infopage, sort=-published, limit=15"; // Find pages that match the selector $matches = $pages->find($selector); // did we find any matches? if($matches->count) { // yes we did $entries = $matches; include("./INC-main-blogroll-panels.html"); } It gave me the search results sorted by publication date, as I expected. Next I modified the first portion of the code by using the following to generate the matches as follows: $matchest = $pages->find("title~=$q, template=BN-article|BN-infopage"); $matchesb = $pages->find("body~=$q, template=BN-article|BN-infopage"); $entries = $matchest->and($matchesb); However, the problem is that $entries in my resultant displayed list did NOT start with those matches that were in the title first from $matchest. It seemed like $matchest->and($matchesb) sorted the resultant list its own way. This is even without the added complication of trying to use unique() afterward to remove duplicates - which appears to have its own default sort. Would anyone please point me in the right direction for what what I'm seeking to do? Thank you so much!
  12. I'm getting an error from sending a search in the search box: "Notice: Trying to get property of non-object in /home/mekanoinsa/www/site/assets/cache/FileCompiler/site/templates/_func.php on line 45Fatal error: Uncaught Error: Call to a member function each() on null in /home/mekanoinsa/www/site/assets/cache/FileCompiler/site/templates/_func.php:49 Stack trace: #0 /home/mekanoinsa/www/site/assets/cache/FileCompiler/site/templates/search.php(42): renderNav(Object(ProcessWire\PageArray)) #1 /home/mekanoinsa/www/wire/core/TemplateFile.php(287): require('/home/mekanoins...') #2 /home/mekanoinsa/www/wire/core/Wire.php(380): ProcessWire\TemplateFile->___render() #3 /home/mekanoinsa/www/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___render', Array) #4 /home/mekanoinsa/www/wire/core/Wire.php(442): ProcessWire\WireHooks->runHooks(Object(ProcessWire\TemplateFile), 'render', Array) #5 /home/mekanoinsa/www/wire/modules/PageRender.module(514): ProcessWire\Wire->__call('render', Array) #6 /home/mekanoinsa/www/wire/core/Wire.php(383): ProcessWire\PageRender->___renderPage(Object(ProcessWire\HookEvent)) #7 /home/mekanoinsa/www/wire/core/WireHooks.php(723): ProcessWire\Wire->_callMethod('___renderPage', Array) #8 /h in /home/mekanoinsa/www/site/assets/cache/FileCompiler/site/templates/_func.php on line 49 This is the code part in _func.php // markup for the text $programme = "{$item->stu_programme->title}"; $out .= "<div class='list'><div class='listtext'><span class='verdana_18_bold'><a href='$item->url'>$item->title</a></span><br><br><span class='verdana'><b>$programme</b><br>"; $out .= $item->workshops_list->each( "<font color='green'>| {title}</font>" ); // if the item has summary text, include that too if($item->summary) $out .= "<br><br>$item->summary"; // end markup for the text $out .= "</div>"; Weird, it doesn't happen all the time and I can't figure out what makes the difference....
  13. Hello I tryed to modify the search template so as to search also descriptions of an upload field. $selector = "title|body|upload->description~=$q, include=hidden, limit=50"; That throws the following exception: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? So how is this correctly done? Thanks.
  14. I've built a site that uses parent pages as the "container" for child pages: Parent page [page.php] -- Child page [unit-child-a.php] -- Child page [unit-child-b.php] ---- Grandchild page [subunit-grandchild-a.php] ---- Grandchild page [subunit-grandchild-b.php] -- Child page [unit-child-c.php] The child pages are displayed as content on the corresponding parent page using the render method. Some child pages also include their own child pages. (Internally the child page template names start with "unit-" and the grandchild page template names start with "subunit-".) Example: foreach ($page->children("template=template-name,sort=sort") as $child) echo $child->render(); This approach allows content administrators to add and reorder child pages as necessary, but I've come across an issue that I'm not sure how to address. The site includes search functionality, but when a visitor searches for content and it is found in a child or grandchild page, the Parent page should be the one that is displayed in the search results, since the child and grandchild pages are not directly viewable. Since some searches could include more than one child or grandchild page of a parent page, this sometimes means that a parent page could be included more than once. How do I easily redirect the child and grandchild pages to the parent page, and only include the parent page once in the search results?
  15. I was thinking about writing a module: Enabling PW to index and search contents of uploaded files. I know the easiest way to include search-inside-files capability is to use Google CSE. Developers who have a dedicated server may of course use of of the "big boys" of search like Lucene, ElasticSearch, Solr etc. For ES you'll need Apache Tomcat, which most people don't have at their disposal, etc. So, my question is, first of all: Would such a feature be used at all? I know you can create some sort of meta-search with file-descriptions, or when using the "one page per file" approach. After some brainstorming, I came up with this: Idea: Make it possible to search file upload content (PDFs, Word, Excel) Approach: Build a module (d'oh) Config settings: select templates / file-fields (what to index) - list all inputfields type "file" “index now” button or “index each time a file is added” or cron? Performance? Where / how to store indexes? As a separate, new field inside each page? On the file-system? In the module folder, each file has a related JSON file? (similar to language files) A new, separate DB-table? What we need: filename / path / URL filetype (to customize search results with file-icons) page id extracted content timestamp of last index-build? MD5/SHA hash or some such? How to handle user roles when doing actual search? Inherit from page? Inherit from file-field? So, what do you think? Not worth it? Does something like this already exist (I searched, but found nothing)?
  16. In my search.php template, I am using $selector = "title|body%=$search_term, limit=50"; to find the top 50 search results for the page. I implemented this following this link https://processwire.com/api/selectors/ My question is how does the selector sort its results? Does it look at the number of time the $search_term has occurred in the page or does it start searching from the root page to all the children. Also, will this change if I do not put any limits to the search results?
  17. I have about 50 pages which are just containers for their child pages. What's the most efficient way to exclude these parent pages from Searches? I'm using Ryan's code here I guess I have a few options but is number 2 here the best way or is there anything I haven't considered which would be better? 1. Mark as 'Hidden: Exclude from lists and searches" Isn't an option because it hides from lists which I use. 2. Tell the selector to ignore a particular template(s) Sounds like a good approach 3. Create my own checkbox called "Search Ignore" and add it into a selector Could work but it seems like a ton of work to manually edit all the pages I want to ignore Cheers
  18. HI all. I recently built a web shop with PW and it works pretty good. I love the simplicity and freedom working with templates and how stuff works and the client loves the back-end. However, the part I am unhappy about is the site search. Beside the API selectors work fine, it seems not be suitable for that kind of search. People search for words, phrases, they mix spaces, hyphens etc., add measurements … so a lot of searches end up in 0 results. I know of the ElasticSearch module and other external things like Sphider, Google CSE, algolia.com … but some are quite complicated and limit my control or bring google's ads on the site So perhaps you have any improvements, ideas how to get a better search engine on my website. Most problems come from spelling issues, singular/plural, hyphenated words/searches. <?php $vars['q'] = $q; $input->whitelist('q', $q); $q = $sanitizer->selectorValue($q); // 1. // Item Number // If there is a number in it that matches a product's numbers, redirect to product directly $q_numeric = preg_replace('/\D/', '', $q); $prodcut_item_number = $pages->get("template=product|product_variation, product_item_number=$q_numeric"); if ( $prodcut_item_number->id && $prodcut_item_number->template == 'product') { $session->redirect($prodcut_item_number->url); die(); } elseif ( $prodcut_item_number->id && $prodcut_item_number->template == 'product_variation') { // variations are saved as sub-pages, but have no public web-page $session->redirect($prodcut_item_number->parent->url); die(); } // 2. // Product title and description // Search the product's title, headline and summary $matches = $pages->find("title|headline|summary~=$q, template=product, limit=50"); // 3. // Categories // If search is a category, append all its products $categories = $pages->find("title%=$q, template=category, limit=10"); if ( count($categories) ) { $category_ids = $categories->each('id'); $category_ids = implode('|', $category_ids); $append_products_from_category = $pages->find("template=product, has_parent={$cat_ids}"); $matches->append($append_products_from_category); } // 4. // Split search phrase // If nothing above matches, try each word separatly if( !count($matches) ) { $q_separate = preg_replace('/\PL/u', ' ', $q); // "Remove" everything but letters $q_separate = preg_split('/\s+/', $q_separate); foreach ($q_separate as $q_word) { if ( $q_word != '' && strlen($q_word) > 4 ) { $append_products_separate = $pages->find("title|headline|summary~=$q_word, template=product, limit=50"); $matches->append($append_products_separate); } } } // PLEASE NOTE – this doesn't come from my production code, but is a current idea I have // There is no highly need of weighting results and order best results on top, because there are just a few products for each keyword :-)
  19. Hello! I have pages that have separated fields for first name and last name. I'm working on a search form that has one single input field, so that if someone search for "John Doe" it should find all pages that have "first_name = John" and "last_name=Doe" or, of course, "first_name=Doe" and "last_name=John". What would be the best use of selectors and operators in this case? I came up with first_name=John|Doe, last_name=John|Doe so that i should split the search key with | I'm not sure this is the best solution. What would you suggest? Thank you!
  20. Hello. Earlier I was able to implement a simple search on a knowledge sharing project for my company but now I was asked to add some functionality where to any page some files can be attached. It went pretty straight forward to use the FieldTypeFile and show up on the frontend all attached files by names. After completting the task I thougth that I could expand my search results allowing the query to search for a string within the attached file names and/or description. So on my working query: $matches = $pages->find("template!=keywords,title|body|keywords~=$q, limit=10"); I tried adding the files_upload field which I created and assigned some file types. The final query got: $matches = $pages->find("template!=keywords,title|body|keywords|file_upload~=$q, limit=10"); but I got a long error text: Error: Exception: SQLSTATE[HY000]: General error: 1191 Can't find FULLTEXT index matching the column list (in C:\OpenServer\domains\nowknow.pw\wire\core\PageFinder.php line 384) #0 [internal function]: ProcessWire\PageFinder->___find(Object(ProcessWire\Selectors), Array) #1 C:\OpenServer\domains\nowknow.pw\wire\core\Wire.php(374): call_user_func_array(Array, Array) #2 C:\OpenServer\domains\nowknow.pw\wire\core\WireHooks.php(549): ProcessWire\Wire->_callMethod('___find', Array) #3 C:\OpenServer\domains\nowknow.pw\wire\core\Wire.php(399): ProcessWire\WireHooks->runHooks(Object(ProcessWire\PageFinder), 'find', Array) #4 C:\OpenServer\domains\nowknow.pw\wire\core\PagesLoader.php(216): ProcessWire\Wire->__call('find', Array) #5 C:\OpenServer\domains\nowknow.pw\wire\core\PagesLoader.php(216): ProcessWire\PageFinder->find(Object(ProcessWire\Selectors), Array) #6 C:\OpenServer\domains\nowknow.pw\wire\core\Pages.php(225): ProcessWire\PagesLoader->find('template!=keywo...', Array) #7 [internal function]: ProcessWire\Pages->_ This error message was shown because: site is in debug mode. ($config->debug = true; => /site/config.php). Error has been logged. Obviously I am not getting the correct way of searching for a file name or file description in the query. Any ideas how to accomplish that?
  21. Hi all. I'm building a product search page with a filter consisting of selects and checkboxes. It's based on Ryan's excellent Skyscraper demo, but I'm trying to add multiple checkbox fieldtypes. I've got it working, but it's not very elegant and I'm sure there's a better way to do it. Given the following checkboxes: [x] Adidas (15) [ ] Asics (10) [x] Nike (20) If only Adidas is checked, 15 shoes will be found; if both Adidas and Nike, 35 shoes will be found. The form field: foreach($pages->get("/brands/")->children() as $brand) { $selected = $brand->name == $input->whitelist->brand ? " checked='checked' " : ""; echo "<label><input $selected type='checkbox' name='brand[]' value='{$brand->name}'> {$brand->title}</label>"; } Here's what I've got for the select, based on the Skyscraper search: $selector = ''; ... if($input->get->brand) { $brands = $input->get->brand; $selector .= "brand="; foreach($brands as $brand) { $value = $brand; $selector .= "$value|"; $input->whitelist('brand', $value); } $selector .= ", "; } ... $selector = "template=product-page, limit=24, " . trim($selector, ", "); This sort of works (although pagination doesn't work because I don't know how to do the whitelist part -- bonus question!). The correct results are returned, but an echo of the selector string looks weird: "template=product-page, limit=24, brand=adidas|nike| " (there's a trailing pipe character that I don't know how to remove). Is there a better way to do this? Thanks in advance.
  22. I really know nothing about ProcessWire, but my site, www.cji.edu, was created with it. On our home page we have a "Search" field. How do you search for a "Date" like "May 5"? "May" by itself doesn't work (maybe it is to short). "June" works by itself but not if you also have a number with it like "June 21". Are there configuration changes that our WebSite Host can make to fix these situations? Thanks.
  23. I have a simple site search using the functions from the default beginner profile in my development site - http://normand.indevelopment.website/ However with debug on I get the following error when trying to SEARCH and then output to the renderNav function. Any ideas? Catchable fatal error: Argument 1 passed to renderNav() must be an instance of PageArray, instance of ProcessWire\PageArray given, called in /home/normandandthomso/public_html/site/templates/search.php on line 52 and defined in /home/normandandthomso/public_html/site/templates/inc/functions.php on line 28
  24. Now that Google is closing down the paid service Google Site Search, and only the free ad version of their search will be available within a year, I have started looking around. It seems that DuckDuckGo has an API that delivers data as JSON. Has anyone used this with ProcessWire and have some code and guidance to offer? Such as listing the results, open for pagination and any other tricks?
  25. Hello PW community, I've a search form which return selected items with pagination. Everything works fine, also the pagination display correctly all results through pages. The issue is given only for selected results pagination as the latter does not start from page 1 but it revert back results from the current page (e.g. if you are in page 3, and submit a result from selects form, than all related items are displayed - not starting from page 1 but from page 3, which means something a fake "no results"). This is the classic function of render pager: echo $works->renderPager(array('arrayToCSV' => false)); Any idea? Thanks! Edit: I've also tried the "start=0" within the selectors, however it Always re-start from page 1 and stick to that, regardless. So no more option to move to page 2, 3, ....
×
×
  • Create New...