Blame view

test_minimal_sort.py 1.62 KB
c86c8237   tangwang   支持聚合。过滤项补充了逻辑,但是有问题
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
  #!/usr/bin/env python3
  """
  Minimal test to isolate sort issue
  """
  
  import requests
  import json
  
  def test_minimal_sort():
      """Test minimal sort case"""
  
      base_url = "http://120.76.41.98:6002"
  
      # Test 1: No sort parameters
      print("Test 1: No sort parameters")
      response = requests.post(f"{base_url}/search/", json={"query": "test", "size": 1})
      print(f"Status: {response.status_code}")
      print(f"Response: {response.text[:200]}...")
  
      # Test 2: Empty sort_by
      print("\nTest 2: Empty sort_by")
      response = requests.post(f"{base_url}/search/", json={"query": "test", "size": 1, "sort_by": ""})
      print(f"Status: {response.status_code}")
      print(f"Response: {response.text[:200]}...")
  
      # Test 3: sort_by only (no sort_order)
      print("\nTest 3: sort_by only")
      response = requests.post(f"{base_url}/search/", json={"query": "test", "size": 1, "sort_by": "create_time"})
      print(f"Status: {response.status_code}")
      print(f"Response: {response.text[:200]}...")
  
      # Test 4: sort_order only (no sort_by)
      print("\nTest 4: sort_order only")
      response = requests.post(f"{base_url}/search/", json={"query": "test", "size": 1, "sort_order": "desc"})
      print(f"Status: {response.status_code}")
      print(f"Response: {response.text[:200]}...")
  
      # Test 5: Both parameters with None values
      print("\nTest 5: Both parameters with null values")
      response = requests.post(f"{base_url}/search/", json={"query": "test", "size": 1, "sort_by": None, "sort_order": None})
      print(f"Status: {response.status_code}")
      print(f"Response: {response.text[:200]}...")
  
  if __name__ == "__main__":
      test_minimal_sort()