Jump to content

Search the Community

Showing results for tags 'xor'.

  • 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

Found 1 result

  1. 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); }
×
×
  • Create New...