summaryrefslogtreecommitdiff
path: root/vendor/plugins/thinking-sphinx/features/searching_by_model.feature
blob: 2e482e4eadfa6adaf02301082f8465728dc4b32e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
Feature: Searching on a single model
  In order to use Thinking Sphinx's core functionality
  A developer
  Should be able to search on a single model
  
  Scenario: Searching using a basic query
    Given Sphinx is running
    And I am searching on people
    When I search for James
    Then I should get 3 results
  
  Scenario: Searching on a specific field
    Given Sphinx is running
    And I am searching on people
    When I search for James on first_name
    Then I should get 2 results
  
  Scenario: Searching on multiple fields
    Given Sphinx is running
    And I am searching on people
    When I search for James on first_name
    And I search for Chamberlain on last_name
    Then I should get 1 result

  Scenario: Searching on association content
	  Given Sphinx is running
	  And I am searching on posts
	
	  When I search for "Waffles"
	  Then I should get 1 result

	  When I search for "Turtle"
	  Then I should get 1 result
  
  Scenario: Searching with a filter
    Given Sphinx is running
    And I am searching on alphas
    When I filter by 1 on value
    Then I should get 1 result
  
  Scenario: Searching with multiple filters
    Given Sphinx is running
    And I am searching on boxes
    When I filter by 2 on width
    And I filter by 2 on length
    Then I should get 1 result
    
  Scenario: Searching to filter multiple values on an MVA
    Given Sphinx is running
    And I am searching on boxes
    When I filter by 11 and 12 on dimensions
    Then I should get 2 results
    When I clear existing filters
    And I filter by both 11 and 12 on dimensions
    Then I should get 1 result
  
  Scenario: Searching on a MVA configured as ranged_query
    Given Sphinx is running
    And I am searching on posts
    When I filter by 1 on comment_ids
    Then I should get 1 result
    When I clear existing filters
    And I filter by both 1 and 2 on comment_ids
    Then I should get 1 results
    When I clear existing filters
    And I filter by 10 on comment_ids
    Then I should get 0 results
  
  Scenario: Searching with ordering by attribute
    Given Sphinx is running
    And I am searching on alphas
    When I order by value
    Then I should get 10 results
    And the value of each result should indicate order
  
  Scenario: Searching with ordering on a sortable field
    Given Sphinx is running
    And I am searching on people
    And I order by first_name
    Then I should get 20 results
    And the first_name of each result should indicate order
  
  Scenario: Intepreting Sphinx Internal Identifiers
    Given Sphinx is running
    And I am searching on people
    Then I should get 20 results
    And each result id should match the corresponding sphinx internal id
  
  Scenario: Retrieving weightings
    Given Sphinx is running
    And I am searching on people
    When I search for "Ellie Ford"
    And I set match mode to any
    Then I can iterate by result and weighting
  
  Scenario: Retrieving group counts
    Given Sphinx is running
    And I am searching on people
    When I group results by the birthday attribute
    Then I can iterate by result and count
  
  Scenario: Retrieving group values
    Given Sphinx is running
    And I am searching on people
    When I group results by the birthday attribute
    Then I can iterate by result and group
  
  Scenario: Retrieving both group values and counts
    Given Sphinx is running
    And I am searching on people
    When I group results by the birthday attribute
    Then I can iterate by result and group and count
  
  Scenario: Searching for ids
    Given Sphinx is running
    And I am searching on people
    When I search for Ellie
    And I am searching for ids
    Then I should have an array of integers
  
  Scenario: Search results should match Sphinx's order
    Given Sphinx is running
    And I am searching on people
    When I search for Ellie
    And I order by "sphinx_internal_id DESC"
    Then searching for ids should match the record ids of the normal search results
  
  Scenario: Retrieving total result count when total is less than a page
    Given Sphinx is running
    And I am searching on people
    When I search for James
    And I am retrieving the result count
    Then I should get a value of 3

  Scenario: Retrieving total result count for more than a page
    Given Sphinx is running
    And I am searching on people
    When I am retrieving the result count
    Then I should get a value of 1000