README.md 3.34 KB
Newer Older
Nathan Ogden's avatar
Nathan Ogden committed
1
2
ThinkCreative Search Bundle
===========================
3
4
5

## Introduction

Nathan Ogden's avatar
Nathan Ogden committed
6
Implements a search page that uses Apache Solr. Includes an eZ Publish filter.
7
8
9

## Installation

Nathan Ogden's avatar
Nathan Ogden committed
10
Add the bundle to app/AppKernel.php (ezpublish/EzPublishKernel.php)...
11
12
13

    new ThinkCreative\SearchBundle\ThinkCreativeSearchBundle()

Nathan Ogden's avatar
Nathan Ogden committed
14
15
## Sample Config Entry

16
The following is a sample configuration...
Nathan Ogden's avatar
Nathan Ogden committed
17
18
19
20
21
22
23
24
25

    think_creative_search:
        solr:
            host: "ef"
            port: 8986
            core: "theoneweekboutique"

        page_layout_template: "OneWeekBoutiqueSiteBundle::base.html.twig"

Nathan Ogden's avatar
Nathan Ogden committed
26
        filter: thinkcreative.search.filter.ezpublish
Nathan Ogden's avatar
Nathan Ogden committed
27
28

        search:
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
            - name: default
              query: "meta_class_identifier_ms:article OR meta_class_identifier_ms:blog_post OR meta_class_identifier_ms:news_item OR meta_class_identifier_ms:event meta_class_identifier_ms:folder"
              highlighting: true
              facet_fields:
                  - display_name: "Content Type"
                    identifier: category
                    field: "meta_class_identifier_ms"
              facet_ranges:
                  - display_name: "Date"
                    identifier: date
                    fields:
                      - "attr_publication_date_dt"
                      - "meta_published_dt"
                    start: "*"
                    end: "NOW"
                    gaps:
                      - name: "Less Than A Week"
                        value: "-7DAYS"
                      - name: "Less Than A Month"
                        value: "-1MONTH"
                      - name: "Less Than 3 Months"
                        value: "-3MONTH"
                      - name: "More Than 3 Months"
                        value: "-3MONTH+1MINUTE"
              sort:
                  - name: "Relevance"
                    value: "score desc, attr_publication_date_dt desc, meta_published_dt desc"
                  - name: "Content Type"
                    value: "meta_class_identifier_ms asc, score desc"
                  - name: "Alphabetically"
                    value: "meta_name_t asc"
                  - name: "Publication Date"
                    value: "attr_publication_date_dt desc, meta_published_dt desc, score desc"
Nathan Ogden's avatar
Nathan Ogden committed
62
63
64
65
66
67
68
69

**solr:**
Information needed to connect to solr server.

**page_layout_template:**
Base page layout template to use on search page.

**filter:**
Nathan Ogden's avatar
Nathan Ogden committed
70
Service that filters Solr field values to human readable values as needed.
Nathan Ogden's avatar
Nathan Ogden committed
71
72
73
74
75
76
77
78
79
80
81
82
83
84

**search:**
Search parameters and constraints.

**search.query:**
Solr query to be included in all searches. Can be used to exclude unwanted results.

**search.facet_fields:**
Used to create facet searches based on given field's unique values from search results.

**search.facet_ranges:**
Used to create facet searches based on ranges, such as a date range.

**search.sort:**
Nathan Ogden's avatar
Nathan Ogden committed
85
Used by sort dropdown on search page to provide sorting options for search results.
86
87
88
89
90
91
92
93
94
95
96
97
98
99


## Usage

Get the 'thinkcreative.search.search' and run the method 'search' with the following paramters...

- Search Type :: Search configuration to use
- Query String :: Query string for search
- Limit :: Limit results per page
- Offset :: Result offset
- Sort :: Defines how search results is sorted
- Facet Values :: Array of current facet values "facet_identifier => facet_value" ... example: "date => -1MONTH"

Returns ThinkCreative\SearchBundle\Classes\SearchResults.