Questions tagged [search]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
15
votes
1answer
3k views

Is it possible to exclude multiple sections from an entry search query?

I'm trying to build a search function that excludes results from certain sections all together. This is the code I was trying to use. {% set entries = craft.entries.search(query).section('not ...
15
votes
2answers
933 views

How can I display search “excerpts” from multiple sections?

How do I create search result page "excerpts" when there are multiple sections/fields that need to be represented?
14
votes
2answers
4k views

How to paginate search results?

What’s the best way to paginate search results? I was using {% set query = craft.request.getParam('q') %} and then {% paginate craft.entries.search(query).section('…').limit(…).order('…') as ...
11
votes
2answers
1k views

Search matrix for blocks with upcoming dates

I have a matrix field with one "event" block type that contains several fields. One of those fields is a date field. Is there a way to get just blocks with upcoming dates?
11
votes
2answers
4k views

How to filter entries by clicking multiple categories on front end

I would like to be able to filter my entries list by multiple categories on the front end. For example, if I first click a category button "lunge" then the results would show entries which are ...
11
votes
2answers
3k views

Advanced Search

Not sure of the best way to progress with this but i'm trying to create an advanced search on a Craft site. What it needs is a select dropdown for Authors, Categories and a normal text input. The ...
10
votes
1answer
5k views

Advanced query/filter based on date and values

I have a channel of events with a field ‘eventDate’ for the date/time of the event. Within that there are ‘types’ of events ‘eventType’. What would be the most efficient way of outputting the NEXT (...
10
votes
2answers
2k views

Excluding fields in a search

Is it possible to exclude some fields when using search? Getting the q parameter from the URL and searching the products section including all fields: {% set query = craft.request.getParam('q') %} {%...
9
votes
2answers
4k views

How would I include the first category slug in the section's entry URL format?

I have a custom section that uses routes like this: /section/category/entry_url In trying to program the search form results I realized that I need to explicitly define the entry URL format for the ...
9
votes
1answer
622 views

Ignore fields in search index

I have a site with ~ 25000 entries, and around 130 custom fields. I tried to rebuild the search index and it didn't complete after 8hours of running none stop. Whilst I'm sure this can be blamed on ...
8
votes
2answers
2k views

Filter based Search Form

Previously on EE I've used Low Search to generate a filter based search form, based on categories. But with Craft I can't seem to find an add-on - Or even know if I need one! What I'm trying to ...
8
votes
1answer
4k views

Display entries if Field Date is past Now

I'm trying to make a upcoming and past event page. I can make an if statement for displaying the past or upcoming events but the problem is if I limit the amount of entries to be displayed I realised ...
8
votes
1answer
1k views

Building a simple search by multiple categories

Is it possible to build the following/is it the right way in Craft. Been through the docs and searched but stuck. I just need to build a form on one page with a dropdown select for 2 categories; ...
7
votes
3answers
12k views

Filter Entries by Field Value

How do I filter a list of entries by the value of a field? For example, if I have a lightswitch field called "Featured", how do I output just the featured entries?
7
votes
1answer
781 views

Using “search” vs. “relatedTo” in a template

I have problems to understand the difference between search and relatedTo. From my understanding, this is a fulltext search on all fields. {% set entries = craft.entries.search(test).order('score') %}...
6
votes
4answers
815 views

What is the best way to track, record or view search terms?

Pretty much like the title says - What is the best way to track, record or view search terms when using the built in Search form?
6
votes
3answers
876 views

How would you recommend integrating craft with Algolia

Has anyone had experience integrating craft with algolia: https://www.algolia.com for realtime search of craft entries. It seems like there are a few potential approaches with their Php and Js ...
6
votes
1answer
1k views

Searching a specific section by four different types of parameters?

I'll do my best to explain this. I have a Portfolio of companies, which I have as a structure, that I need to be able to filter/search through by using up to four different parameters. Keyword - a ...
5
votes
2answers
2k views

How do I get extracts in search results?

Say someone searches for "John Smith". Using the search results template on the Craft website, my search results are then a list of titles for entries that include the term "John Smith". For example: ...
5
votes
1answer
1k views

Search order “Score” criteria

Leading on from this question by Chris Lewis I can't seem to find anything on the technicals, but by what criteria "best-match to worst-match" calculated? For example, if I was to have, an entry ...
5
votes
3answers
2k views

Search for related entries based on tags

On an entry page I search for related entries based on the tags assigned to the respective entry. The following example works: {% set tags = entry.q_tags.first %} {% for tag in entry.q_tags.offset(1)...
5
votes
3answers
1k views

Entry not showing up in search results?

Can anyone help identify why one on my entries is not being picked up in my search query? The search terms are 'hampshire 10k' and the craft_searchindex table for this entry looks like this: The ...
5
votes
3answers
993 views

Filter entries by entry type in the CP?

We have a channel called Articles with multiple entry types. Is it possible to filter the entries within Craft (on the Entries page) by entry type?
5
votes
1answer
1k views

multiple search

My question could seem obvious but I don't find the solution. How to make a search on two fields, like: craft.entries.section('pages').search('foo:bar foo2:bar2') I tried search('foo:bar', 'foo2:...
5
votes
1answer
193 views

Bug with non-ascii characters, quotes and OR operator in search?

There seems to be a bug when I combine non-ascii characters, quotes and the OR operator when searching. All of these queries work ok: "pølser" "pålegg" pølser OR pålegg "egg" OR "spekemat" but "...
5
votes
1answer
120 views

Best way to effect part word searching by default

I want to use the standard site search but much prefer that (first) part word search is in place by default. By this I mean if a user searches for dog they will also find dogs, so the term Craft uses ...
5
votes
1answer
991 views

Is there a way to reduce the search index?

Our search index table (craft_searchindex) is over 500,000 rows and it takes a few hours to index. We have 11 languages, and each is being fully indexed. It takes a few hours to complete. Are there ...
5
votes
1answer
435 views

Modifying search scoring algorithm

Is there any way to tweak the way search score is calculated? For example, I would like words in the title field to be scored higher than the same terms in other fields.
4
votes
2answers
2k views

Building Results From Advanced Search Form

I'm building an advanced search form and having some difficulty with getting the results. The form inputs include price and year ranges. For example, search for used cars from $10,000 to $20,000. The ...
4
votes
1answer
484 views

Select entries starting with same letter from alphabet list

I have a list of all my games using pagination. It works great: http://www.colorcomputergames.com/games However, I'd like to add links at the top of the page like: A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|...
4
votes
1answer
1k views

How to fetch entries in custom plugin Craft 3?

I am creating custom search based on entries. I need to fetch entries in custom plugin.
4
votes
1answer
899 views

Craft 3 Multi Category and Field Search

Looking for the solution to searching entries in one section that are related to multiple categories and match number field criteria. This is for a used auto website. Categories: Make/Model/Trim: ...
4
votes
3answers
2k views

Search for entries with matrix field's value

I'm building a travel site containing Campaigns (entries) Each of these campaigns has multiple travel dates, modelled by a matrix field of [startDate, endDate, price] I want to do the following ...
4
votes
1answer
812 views

Search Results In a Drop List/Popup on Same Page

Does anyone have an example how I would implement search results that appear in a popup on the same form (without redirecting to a results page). The idea would be that as they start to type in the ...
4
votes
1answer
798 views

Paginate an array with multiple filters

I'm looking to paginate and array with multiple filters. The current url would be: www.example.com/search?filter=shorts&type=leather&brand=sams Clicking on the next next link returns: www....
4
votes
2answers
233 views

Method (plugin free?) to combine search results across multiple searches (and element types)

So I have created a combined search for products and entries using the new Craft 2.5 search score. It's working well, but...I was hoping to be able to do this without a plugin if possible ... but it ...
4
votes
1answer
712 views

Using search to display entries based on a value in a number field

I'm trying to return results based on a year stored in a custom field. For example, returning entries with a model year greater than 2006 and less than 2009. Is there a search syntax to support this? ...
4
votes
1answer
665 views

searching assets - using related entry slug

For a website I'm currently building I have a bunch of photos within an Assets folder (folder id of 5) that I have linked to "Photographer" entries within a "Photographers" structure. I am now trying ...
4
votes
1answer
242 views

Limit search results for users by tag (and limit to 5 tags)

I've read as many forum posts and documentation but am a little stumped over a specific use-case. Currently the search page grabs the url segment, loops through a verified user group, and uses the ....
3
votes
2answers
1k views

Converting array of entries to an array of ids

If I've got an array of entries, is there a less long winded approach to convert that to an array of ids so I can use it in another lookup. {# Look up authors that match the entered query. {% set ...
3
votes
2answers
658 views

Check if Category is in Query

I'm trying to check to see if a particular category (In a loop) exists in a query submitted from a search form. At the moment I'm doing this inside a 'childCategory' loop... {% for childCategory in ...
3
votes
2answers
2k views

How to query using variables

I'm having issues with getting results from a query. I have 2 search parameters which i have set to variables. I would like to match both of these to get results. At the moment the query is returning ...
3
votes
2answers
2k views

Searching multiple queries using CraftCMS search function

As you can see in the code below I'm currently searching for the keyword but how can I make it so it picks up on entries that have a matching keyword, location & salary or if they don't fill out ...
3
votes
1answer
112 views

.relatedTo() not returning tags with spaces

I think I'm seeing a bug while using advanced search with relatedTo(). If I use a simple search, like this: {% set param = { order: 'RAND()', limit: null, search: "#{request.tags}" } %} It ...
3
votes
1answer
2k views

How do I combine search for categories and entries into one set of search results?

I have a search page. I can search either categories or entries using {% set entries = craft.entries.search(query).order('score') %} {% set categories = craft.categories.search(query).order('score') %...
3
votes
1answer
203 views

Get field that contains search query

After a standard search with something like: {% set results = craft.entries.search( query ) %} {% for result in results %} <ul> <li>{{ result.link }}</li> </ul>...
3
votes
1answer
409 views

Hide search results depending on field value

This is my search results query: {% set query = craft.request.getParam('q') %} {% set miniCards = craft.entries.search(query).order('score').limit(12) %} I have a lightswitch field called ...
3
votes
1answer
739 views

How to search using partial words?

Is it me, or can we not search using partial words in Craft CMS? This seems to be the case in the backend when search entry titles or assets, but a client has recently pointed it out on the front-end ...
3
votes
1answer
437 views

Is it possible to cache a faceted search form?

I have created a search form which allows user to search multiple categories groups and multiple categories within those groups. So I have Type [] Category 1 [x] Category 2 [] Category 3 ... ...
3
votes
1answer
665 views

How do I filter entries in CP by Entry Type?

I have an entry type called industry and am trying to use this search syntax in the CP to filter my entries by that type: type:"industry" I am getting no results whatsoever. How do I filter entries ...

1
2 3 4 5 6