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. Hello processwire community, this is my very first post, I am newbie in php - trying to test a simple search form which allow frontend user to search and filter data. Macro steps are as follow: 1) Create the form with options as checkboxes, allowing the user to choose multiple values selection within multiple checkbox groups; 2) Create the pw process code in order to revert back the selected items (as a result of multiple checkbox filter combination), allowing pagination as some results may be more than 50 items; --- Here some of the most related topics I've found over PW forum: https://processwire.com/talk/topic/7282-paging-issue-with-html-form-check-boxes/ https://processwire.com/talk/topic/3472-enable-pagination-for-search-results/#comment-38214 https://processwire.com/talk/topic/1883-how-to-use-input-whitelist-with-checkboxes-or-any-array/ https://processwire.com/talk/topic/1547-getting-multiple-checkbox-values-within-processwire/ https://processwire.com/talk/topic/1034-search-form-with-multiple-fields/ https://processwire.com/talk/topic/10193-multiselect-search/ --- Now, the html form works just fine (code below), it brings all checked values to the url string. Essentially I have four different groups of checkboxes: cb_sectors[] (multiple pages as categories); cb_expertise[] (multiple pages as categories); cb_status[] (multiple pages as categories); cb_year[] (integer). The user may select multiple values within the above four checkbox groups, thus creating even quite complex combination. <form name='search' id='search-works' method='get' role='form' action='<?php echo $pages->get('/search/')->url; ?>'> <div class="collapsible-header">Sector</div> <?php foreach($pages->get("/sectors")->children as $sec) echo " <p class='checkbox'> <input type='checkbox' name='cb_sectors[]' value='{$sec->name}' id='{$sec->name}'/> <label for='{$sec->name}'>{$sec->title}</label> </p> " ?> <div class="collapsible-header">Status</div> <?php foreach($pages->get("/taxonomy/Status")->children as $st) echo " <p class='checkbox'> <input type='checkbox' name='cb_status[]' value='{$st->name}' id='{$st->name}' /> <label for='{$st->name}'>{$st->title}</label> </p> " ?> <div class="collapsible-header no-padding">Expertise</div> <?php foreach($pages->get("/expertise")->children as $cb_expertise) $checked = $cb_expertise->name == $input->whitelist->cb_expertise ? " selected='selected' " : ''; echo " <p class='checkbox'> <input type='checkbox' name='cb_expertise[]' value='{$cb_expertise->name}' id='{$cb_expertise->name}' $checked/> <label for='{$cb_expertise->name}'>{$cb_expertise->title}</label> </p> " ?> <div class="collapsible-header no-padding">Year</div> <?php // generate a range of years from '09 to '17, or maybe better doing it via pages as years? for($year = 2009; $year <= 2017; $year += 1){ echo " <p class='checkbox'> <input type='checkbox' name='cb_year[]' value='$year' id='$year' /> <label for='$year'>{$year}</label> </p> "; } ?> <input class="no-class" type="submit" id="search-submit" name="submit" value="Search"> </form> The question is then mostly focusing on the second step, the pw process code: As some previous posts on this topic say - I should (in sequence) sanitize, whitelist and validate the results before pass them to the final output (correct me if I'm wrong). The thing is that I cannot find a way to get all values in a array and sanitize/whitelist/validate them -> some post suggest to use arraytoCSV as a way to let PW remember the filtered items while moving through pagination. Is arraytoCSV the best way to sanitize and whitelist the user input combination? The following code simply get selected values coming from the above form. As you can see, no sanitize nor whitelist nor validation is in place, as without the array the sanitizing function gives back only the last selected value (not the full combination for every group of checkboxes). Can you please help me implementing an array within the following code and the way to sanitize - whitelist - validate "get" values? I know for most of you is just as simple as drinking coffe, but would be great if you could drive me in the right direction. Thank you in advance! <?php namespace ProcessWire; if(count($input->get)) { if($input->get->cb_expertise) { foreach ($input->get->cb_expertise as $expertise) { // here we are just ensuring submitted products are in fact valid echo $expertise; } } if($input->get->cb_sectors) { foreach($input->get->cb_sectors as $sector) { // here we are just ensuring submitted products are in fact valid echo $sector; } } if($input->get->cb_status) { foreach($input->get->cb_status as $status) { // here we are just ensuring submitted products are in fact valid echo $status; } } if($input->get->cb_year) { foreach($input->get->cb_year as $year) { // here we are just ensuring submitted products are in fact valid echo $year; } } } ?>
  2. Hi guys, I would like to realize a search function on my site that follows some clear rules: 1 – Search is performed in the two fields 'tite' and 'body'. 2 – If a user searches for 'foo' and 'bar' he can select whether both terms have to be in at least one of the fields (AND) or at least one of the terms has to be in at least one of the fields (OR). 3 – 'foo' should match words like 'food' or 'foolish' as well as 'foo' (LIKE). 4 – Search results where 'foo' or 'bar' are found in the title should be displayed first, followed by the results found in 'body' only. This is what I have: <?php if($input->get->q) { $q = $sanitizer->text($input->get->q); if($q) { $input->whitelist('q', $q); $qs = explode(" ", $q); foreach($qs as $key => $q) : $qs[$key] = $sanitizer->selectorValue($q); endforeach; $selector1 = "title%=".implode("|", $qs).", template=entry, limit=50"; $selector2 = "body%=".implode("|", $qs).", template=entry, limit=50"; // Trying to separate 'important' title matches from 'less important' body matches $matches = $pages->find($selector1); if ($matches->count) < $limit)) $matches->import($pages->find($selector2)); if ($matches->count) { foreach($matches as $m) : // Output matches title & body excerpt endforeach; } else { // Output no matches } } } else { // Output no search term(s) } ?> First problem is regarding rule 2: I don’t know how to do an AND search. As far as I can see, it’s always an OR. Second problem is the order of the search results (rule 4): I split the queries to separate them nicely, but they appear mixed up. Output starts with a few title matches as I would expect, followed by some body matches, then some further title matches appears. I don’t understand how this happens: $matches->import adds array 2 to array 1 without mixing them, isn’t that true? And just in case I will get the job done someday: how could I avoid doubled matches? Matches in body aren’t that interesting anymore, when the terms was already found in the title field. I will appreciate any helping hand – thanks. Ralf
  3. Hi, I have a site search working correctly on a project, however I seem to be having issue when the search term contains characters such as question marks or brackets. I'm doing the following... $q = $input->get->text('q'); if($q) { $input->whitelist('q', $q); $q = $input->get->selectorValue('q'); } $matches = "search_cache~={$q}, sort=-publish_date"; This works correctly for everything except searches that include characters such as ? or ( ) So for example a searches for the following (where the page title is "example title?") example title example title? The first one works as expected and the second returns 0 results. As the titles are very specific for a user to search, I need to make sure the search works with these kind of characters. How can I make sure search works with these kind of characters?
  4. Am I right in understanding that there's no way to escape or encode a dash ("-") for use within a selector value (that has to be sanitized)? Looking at the code for $sanitizer it looks like it's just converted to a space. That seemingly makes it impossible to search for terms like "x-ray." Any workarounds for this?
  5. Hi everyone, I want to start a new project that is community-based and would like to use PW for that. Some of the requirements: User management User sign up by email, google, linkedin, facebook User management by admin each user gets a profile page each user can define his own custom URL for his profile page users can password protect their profiles anti-spam: Flag button for profiles, track number of login attempts then block users can specify arbitrary user fields (!) (self-defined) - I did this once in another framework by a meta-table: "userid | title | value" Search users can find other users, search must index all user fields Misc Logging of all users events (e.g. user A accessed profile of user B, user C logged in, user D got blocked by admin, etc.) all pages via https Let's imagine there would be 100 000 users - Will it still be fast enough? Can ProcessWire fulfill all those requirements?
  6. Hello, i am trying to search page with multiple options like, i have one select box where i can select multiple items as <select id="tokenize" name="tokenize" multiple="multiple" class="tokenize-sample" /> i have GET form and when i submit the form i get values like search/?tokenize=abc&tokenize=xyz now in my search page $children = $pages->find("template=property, Ad_Type=".$ptype." ,Area=".$tokenize); as you can see i have passed multiple values of tokenize, how can i search page contains all values ? Thanks
  7. Hello together, currently I’m working on some kind of enhanced search for pages->find in the FRONTEND and I like to ask if someone has a possible solution or hint on how to build it. My problem is, I like to add search strings with a "+" or "-" in front of word and tell PW what to search and what not based on the input of the user. Example: Let say I have the following page tree Airports — NYC, USA — Miami, USA — Tokyio, Japan — Berlin, Germany Let’s say that all pages have more then one body text field but in one of them is a text that contains the words "Airport" and "Air-condition". User enter the following text into an input field: Airport air +USA -nyc My preferences are: 1) find all Airports (or cities) with the word Airport or air in the title OR in the body text of the pages, also find part of the words like fair or air-condition 2) Filter the results of 1) and find only pages with the word USA inside 3) Filter the results of 2) and show only (exclude) the results with a word like nyc As the result only Miami, USA will be displayed, because it got USA and NOT nyc and in the body text are the words Airport and air-condition. For 1) I used the code (see below) from @Mats suggestion https://processwire.com/talk/topic/10883-search-with-and-string/ It searches part of words in the title and body with OR. But what I’m looking for is, how can I search for pages that have the search term AND the term with a "+" before. It finds me Airport but it should only find Airport if +USA is inside title of body text. And of course, how it is possible to exclude a word, for example with a "-" before the search term. In spoken language it would be: Find anything with Airport or air. Show only results containing the word USA and exclude anything from the results with the word nyc. In general, is it possible to exclude something from the search in pages->find and what could be a good start to code such a search function? Thanks so much in advance! Thomas if($q) { $input->whitelist('q', $q); $qs = explode(" ", $q); foreach($qs as $key => $q){ $qs[$key] = $sanitizer->selectorValue($q); } $selector = "template=print, title|body|body_2|body_3%=" . implode("|", $qs) . ", limit=50"; $matches = $pages->find($selector); }
  8. Hey folks, I did some digging to see if I could find anything on this, but I couldn't turn up anything. Does any one have a recommendation on how to track the terms that users enter in my site search? Thanks for any thoughts!
  9. Hey folks, If I search for a page that is unpublished it can not be found by using the ajax search in the right corner in admin. It can only be found when I am logged in as a Superuser, but not if I am logged in as an Editor (who has page-edit rights!). Searching through lister works - but only if I choose to only search unpublished pages; but not via the ajax search at all. I already looked at the process page search module file and there is a line that allows unpublished pages to be searched if someone has paeg-edit rights, but somehow it does not work at all. Can someone help? Thank you so much!
  10. Hi there! I want to implement a "simple" full text search (no ajax needed) into a webpage that's built with processwire. I couldn't find any threads, tutorials or modules helping with this. Can anyone help me with this or point me to a place where I find information how to implement this? Thanks in advance! Jonas
  11. Hello everyone, I always wanted to try out an ajax autocomplete search function, but never knew where to start. Of course there is the Ajax Page Search module by soma, but it seems that it was build around the basic site profile. In my case I wanted something more custom and I discovered in this thread the jQuery Plugin Typeahead by RunningCoder, which seemed to be nice. After many hours figuring out, how to combine this Plugin with ProcessWire, I finally got it implemented and want to share my solution with anyone, who also struggles with this topic. 1. Set-Up Typeahead Download the Typeahead-Plugin from the website (I prefer via Bower) and include the following scripts and stylesheets in your templates: <html> <head> ... <!-- Optional CSS --> <link rel="stylesheet" href="/vendor/jquery-typeahead/dist/jquery.typeahead.min.css"> <!-- Required JavaScript --> <script src="https://code.jquery.com/jquery-2.1.3.min.js"></script> <script src="/vendor/jquery-typeahead/dist/jquery.typeahead.min.js"></script> ... </head> As next step we need the JSON data. 2. Install Pages to JSON To get the necessary data of all pages as JSON, I use the module Pages to JSON, which provides an easy way to output pages as JSON objects. Of course you can achieve this without this module, but I am not very experienced with JSON, so this module was really helpful. After you downloaded and installed the module, you can configure in the module settings page, which fields you want to output. You can select between own and system fields. For my purpose I selected only title and url to be outputted. 3. Output JSON Now, that we have the module configured, we have to output our search suggestions as JSON. I did it in my template file search.php like this: <?php namespace ProcessWire; // Check if ajax request if($config->ajax) { $results = $pages->find("has_parent!=2"); // Find all published pages and save as $results header("Content-type: application/json"); // Set header to JSON echo $results->toJSON(); // Output the results as JSON via the toJSON function } else { // Your own front-end template } To sum up, we search the pages we want as search suggestions and save them in a variable. Then we output them with the toJSON-Function by the Pages to JSON-Module. All of this happens in a Ajax-Request, that is the reason why we check first, if the page is called via an Ajax request. 4. Insert Form We can now embed the HTML form anywhere you want. Either in an header-include or a specific template. Also you can use your own classes, for this example I used the Typeahead-demo-mark-up and extended it a little. <form id="searchform" method="get" action="<?= $pages->get("template=search")->url ?>"> <div class="typeahead__container"> <div class="typeahead__field"> <span class="typeahead__query"> <input id="q" name="q" type="search" placeholder="Search" autocomplete="off"> </span> <span class="typeahead__button"> <button type="submit"> <span class="typeahead__search-icon"></span> </button> </span> </div> </div> </form> The action-attribute in the form-tag is the url of your search-site. This attribute is of course necessary to know where the form redirects you and where the JSON data is located. 5. Initialize Typeahead As last step we have to initialize the Typeahead-plugin jQuery like this: $(document).ready(function() { var actionURL = $('#searchform').attr('action'); // Save form action url in variable $.typeahead({ input: '#q', hint: true, display: ["title"], // Search objects by the title-key source: { url: actionURL // Ajax request to get JSON from the action url }, callback: { // Redirect to url after clicking or pressing enter onClickAfter: function (node, a, item, event) { window.location.href = item.url; // Set window location to site url } } }); }); We save the action url of the form in a variable, then we initialize Typeahead by selecting the input-field inside the form. As the source we can pass the action url and I included the callback, to link the search results with the site urls. Now you should have a nice ajax autocomplete search form, which of course you can further style and configure. I hope I didn't forget anything, but if so, please let me know. Regards, Andreas
  12. Hi folks, I have a simple search setup, and I'm wanting the order of results to be sorted by parent then created date. I currently have this set up as: sort=-parent, sort=-created And here is a screenshot of my Tree structure from the CMS: However, when I get the search results; the result is putting Portfolio results before People results... any ideas where I am going wrong? I'm thinking it's to do with the fact that a 'person' has the parent 'People' but also 'People & Practice' but then couldn't work out why it was being returned in the order before 'Now'? EDIT: Thinking about it, it's because the ID of Portfolio is 1028 but the People ID is 1048; do I need to do it by sort first, then parent, then created? Thanks in advance, R
  13. I've implemented a site search on a site and am a bit confused about how it processes results. For instance, a search for art union produces no results, same for a search for art, but a search for union produces 5 results including the one I was hoping would come up which has a title of art union. How/why is that happening and is there anything to configure to improve the results? My search form looks like: <form action="<?php echo $pages->get("template=search")->url; ?>" method="get"> <input type="text" name="q"> <button type="submit">Search</button> </form> and the search template: if($q = $sanitizer->selectorValue($input->get->q)) : $input->whitelist('q', $q); $matches = $pages->find("title|body|summary~=$q,template!=admin, limit=50"); $count = count($matches); if($count) : foreach($matches as $m) : … endforeach; endif; else: … endif;
  14. Hi all, i been trying some things with a customized search form and suddenly it throws an SQLSTATE error. can somebody explain what i did wrong? it's the code from the site-classic template... if i leave the selector empty i get all pages in result, if i add any selector it returns this error. <?php $out = ''; if($q = $sanitizer->selectorValue($input->get->q)) { // Send our sanitized query 'q' variable to the whitelist where it will be // picked up and echoed in the search box by the head.inc file. $input->whitelist('q', $q); // Search the title, body and sidebar fields for our query text. // Limit the results to 50 pages. // Exclude results that use the 'admin' template. $matches = $pages->find("title~=$q, limit=50"); $count = count($matches); if($count) { $out .= "<h2>Found $count pages matching your query:</h2>" . "<ul class='nav'>"; foreach($matches as $m) { $out .= "<li><p><a href='{$m->url}'>{$m->title}</a><br />{$m->summary}</p></li>"; } $out .= "</ul>"; } else { $out .= "<h2>Sorry, no results were found.</h2>"; } } else { $out .= "<h2>Please enter a search term in the search box (upper right corner)</h2>"; } ?> thanks in advance, ocr_a
  15. I need to extend the search capability to image descriptions through the default search template in 2.5.3. $matches = $pages->find("title|body|sidebar|thumb_one|thumb_two|thumb_three|thumb_four|gallery_img%=$q, limit=50"); I've added additional field selectors, but with inconsistent results. Is there a better way to achieve this?
  16. Hi, Having ploblems with this search page code. I'm trying to get all images with tagged with the search query, which works currently. Then get a url and add <a> wrapping the image to a page that references that image in its image_select field - doesnt work. if($input->get->q) { $q = $sanitizer->selectorValue($input->get->q); $input->whitelist('q', $q); } $matches = $pages->find("imageTags.title%=$q, limit=20"); if(count($matches)) { $out .= "<ul class='grid-list'>"; foreach($matches as $m){ // $name = $m->image->name; // $out = $name; // $mWork = $pages->find("image_select=$name, limit=1"); // var_dump($mWork); $out .= "<li>"; // $out .= "<a class='' href='{$mWork->url}'>"; $image = $m->image; $image = $image->width(450); if($image) $out .= "<img src='$image->url'>"; // echo "</a>"; echo "</li>"; } $out .= "</ul>"; }
  17. Hi Guys, I am trying to implement a website that uses processwire as the content management system. I am trying to create a page where stars can be added to a christmas tree, each star is a repeater field and is associated to a modal pop up which displays a message. There may be more stars than what we can physically put on the tree so I have implemented the search function to allow users to search for a name or message in order to find their star. At the minute the search function is showing the results from the repeater fields, I have 2 stars at the minute however only one shows in the search results. 1 star has test in all the fields and the other has mel in each of the fields. I have no idea why only one result will show, any help would be greatly appreciated. The link to the page is as follows: http://www.friendsofthecancercentre.com/wish-upon-a-star/ <?php $out = ''; if($q = $sanitizer->selectorValue($input->get->q)) { // Send our sanitized query 'q' variable to the whitelist where it will be // picked up and echoed in the search box by the head.inc file. $input->whitelist('q', $q); // Search the title, body and sidebar fields for our query text. // Limit the results to 50 pages. // Exclude results that use the 'admin' template. $matches = $pages->find("star.message|star.who|star.from*=$q,"); $count = count($matches); if($count) { $out .= "<h2>Found $count fields matching your query:</h2>" . "<ul class='nav'>"; foreach($matches as $m) { $out .= " <li><p><a href='{$m->url}'>{$m->title}</a><br />{$m->summary}</p></li>"; } $out .= "</ul>"; } else { $out .= "<h2>Sorry, no results were found.</h2>"; } } else { $out .= "<h2>Please enter a search term in the search box (upper right corner)</h2>"; }
  18. Hello! I like to share a project developed using ProcessWire. App-UNIVERSE.net is a modern online service with software database download. We provide access to a rich app database for desktop operating systems based on Windows and Mac OS. Within each category we present both free and commercial apps used by professionals in industries as movie creation, interior design, transportation, creating presentations, coding apps and games, etc. All available apps in App-UNIVERSE contain information like license, name of developer, date of app update, actual description of main features and direct links to files hosted on developers homepage. Site visitors can search for apps not only through the catalog, but also an advanced search engine. Applications can be searched by criteria such as category, developer, name of the application or alternative. Unlike many competing sites we do not offer download of files via download assistant that under the pretext of simplifying the process of installing apps are spying software and are installing in system toolbars and other unnecessary components. We focus primarily on all valuable apps that we can height recommend to our users.
  19. I am building off the default install, and noticed that, in practice, the included search template limits me to a single search term (or an exact phrase of more than one word). How can I get it to search a simple boolean-type string, with an AND or OR? The template PHP code: $q = $sanitizer->text($input->get->q); if($q) { $input->whitelist('q', $q); $q = $sanitizer->selectorValue($q); $selector = "title|body|interests~=$q, limit=50"; if($user->isLoggedin()) $selector .= ", has_parent!=2"; $matches = $pages->find($selector); if($matches->count) { $content .= "<h2>Found $matches->count pages matching your query:</h2>"; $content .= renderNavPanel($matches); } else { $content = "<h2>Sorry, no results were found.</h2>"; } } else { $content = "<h2>Please enter a search term in the search box (upper right corner)</h2>"; } I've tried every permutation of entering the data I can think of (x y; x AND y; x&y; x, y; "x" AND "y"; x + y; etc.; etc.) , but whenever I put in more than one search term, I get zero results—even if each of the words, when searched alone, does produce results. I even experimented replacing the two $sanitizer types with bool, but that threw ugly errors. About to pull my hair out over this. I am sure there is a simple answer, but as I haven't worked much with any sort of input features (built static sites for years), I cannot seem to crack it. Forgive me is this if Kindergarten-level. Thanks.
  20. I have a question on how to group search results by template, with pages sorted alphabetical (as standard) in each group. I have a film blog running ProcessWire. It has lots of posts, ratings, categories, ratings, directors, actors and tags, my search result is getting crowded by all this pages after a while. These pages have different templates. Until now I have had badges with the template label by their title in the search result. I am wondering if there's a simple way of coding it to group the search result, kind of like how IMDb does it: Titles are grouped first, then names second. Like this. To illustrate, here's a part of my structure, template name in brackets: --- Main (home) Blog (posts) Movie 1 (post) Movie 2 Actor (actors) Actor 1 (actor) Actor 2 Director (directors) Director 1 (director) Director 2 Tag (tags) Tag 1 (tag) Tag 2 --- And here's how I would want my search result to show, e.g. if all these pages where to mention Tom Hanks somehow: --- Movies: Movie 1 Movie 2 Directors: Director 1 Director 2 Tags: Tag 1 Tag 2 Actors: Actor 1 Actor 2 --- I am in a learning process, and I am sure there are other problems that will appear when considering usability. Limits within groups, etc. But for now this is a way of sorting that I might also want to use elsewhere later on. Whereas I have headings and results in separate lists. (PS: I have read a couple of posts on group sorting based on parent ID, but none of them was exactly what I was looking for.)
  21. I have the following sidebar.inc included on my Shop page which is the main index of items: <?php foreach($input->get as $key => $val) { echo htmlentities("$key = $val") . "<br>"; } $selector = ''; $summary = array( "categories" => "", "agegroups" => "", "keywords" => "", ); if($input->get->categories) {} $sidebar = "<form id='search_form' method='get' action='{$config->urls->root}shop/'><div class='row'>"; $taxonomies = $pages->find("template=product_taxonomies"); foreach($taxonomies as $t) { $items = $t->children; $sidebar .= "<div class='small-6 large-12 columns'><h3>{$t->title}</h3>"; foreach($items as $i) { $sidebar .= "<input id='$i->name' name='$t->name' value='$i->name' type='checkbox'><label for='$i->name'>$i->title</label><br>"; } $sidebar .= "</div>"; } $sidebar .= "<input id='search_keyword' name='keyword' type='text'/>"; $sidebar .= "<div class='large-12 columns'><input type='submit' id='search_submit' name='submit' value='Search'></div></div></form>"; Checking more than one input of the same name only produces the last value of those. Can anyone advise me on how to make these multi-select filters return multiple values?
  22. Hi there, so, I'm quite new to ProcessWire, I am currently building my first site with it, I'm almost done, everything went smoothly.. up until now. I've been trying to build a search function for hours now and I did get it to work after a while, but not in a very satisfactory manner. As a starting point I used the code from the "site-classic" templates, but the problem is: API-calls don't seem to work. It all starts off with if ($q = $sanitizer->selectorValue($input->get->q)) { Which gives me the following "Error: Call to a member function selectorValue() on a non-object" Investigating lead me to finding, that it won't just call selectorValue, but also, that $input->get->q does not exist. Actually $input itself is null and so is $sanitizer. Which also leads me to not being able to whitelist q, as I can't call $input->whitelist() The only way for me to retrieve the query value is via $_GET["q"], which does work. So this was my main issue. Another question would be: in the search template of site-classic it is said: // Search the title, body and sidebar fields for our query text. // Limit the results to 50 pages. // Exclude results that use the 'admin' template. $matches = $pages->find("title|body|sidebar~=$q, limit=50"); But I don't see any constraint actually excluding admin templates. If I enter the term "template" into my search, I get a nice link in my search results into my backend "/processwire/access/permissions/page-template/". How to prevent this? I hope you can help me with my issues. Thanks a lot! a
  23. Hello, i am trying to built one job search form but its not working, bellow is my code <form method="get" action="<?=$config->urls->root;?>search/"> <input type="text" placeholder="Keyword Search" name="keyword" id="keyword"> <select name="job_sector" id="job_sector"> <option>All Sectors</option> <option>Human Resources</option> <option>Consulting</option> </select> <select name="job_level" id="job_level"> <option>All Jobs Level</option> <option>Executive</option> <option>Manager</option> </select> <select name="job_location" id="job_location" > <option>All Locations </option> <option>city1</option> <option>city2</option> </select> <input type="submit" class="btn btn-primary btn-medium" value="Search Jobs" > </form> <?php $search_cat=""; // find any matching keyword if($input->get->job_keyword) { $search_cat="job_keyword~=".$input->get->job_keyword; } if($input->get->job_sector) { $search_cat=$search_cat.",job_sector=".$input->get->job_sector; } if($input->get->job_level) { $search_cat=$search_cat.",job_level=".$input->get->job_level; } if($input->get->job_location) { $search_cat=$search_cat.",job_location=".$input->get->job_location; } $jobs=$pages->find("template=job,$search_cat"); foreach($jobs as $job) { ?> but this code is not working. i want to find all pages with template job and any field select on form. Thanks
  24. Sorry if this a bit of a rant. I'm in the last steps of getting our intranet "reborn" on PW, and one still unanswered question is what search backend to use. As with most intranets it holds quite a big number of office and pdf files. I've already tried a few of the major open source search engines like ElasticSearch, Solr, Sphinx and OpenSearchServer, and I found all of them lacking in two regards - for one, the documentation is all over the place so you never know if the piece you're reading even applies to the version you're using, and the implementations of their APIs are just horribly awkward and extremely picky in regards to the slightest deviations from their "standard" (which isn't really concisely documented) syntax. None of them comes with a basic permission system, which is an absolute must have. I can probably work around that with facets or the like, but still... you'd think everybody all over the world but me only indexes public webpages. Design decisions like using JSON objects that have multiple identically named properties make me doubt the sanity of those maintaining the software. Looking at all these points, I'm now also considering rolling my own on top of an InnoDB fulltext index, just re-using the text extractors I've already running in the old system (up to now only feeding the extracted plaintext into a MySQL table and doing literal searches), adding a fulltext index, setting up a lean API module for the few search variants I need and be done with it. That, of course, still leaves the topic of extracting relevant snippets open - should I write my own UDF for that, or are there (functional and maintained) third party extensions available to do just that? A question that warrants some more digging for an educated decision. I'm still a bit torn, but there's also the time factor to consider. If any of you has experiences with searches (especially with implementing visibility of search content using a group-based permission concept) and could throw in a few pointers or experiences, I'd be glad.
  25. I found that search with substring of asian text is not working properly Some substring can be found but some are not. Here is a demo of this issue. Searching a japanese page
×
×
  • Create New...